News Pages

A

Anonymous

Guest
Hi, i have got a news page which displays all the News in the database.

But i only want to limit the stories on this page to 90 characteristics. There is then a link on the story which views all of the story on the page.

Any help.

Cheers

Adam
 
AaaDee said:
Hi, i have got a news page which displays all the News in the database.

But i only want to limit the stories on this page to 90 characteristics. There is then a link on the story which views all of the story on the page.

Any help.

Cheers

Adam
RTFM about strlen.
 
AaaDee said:
what does that mean?
Read
The
F..ing
Manual

about strlen
And one more question how old are you? and how long time you learn PHP?
 
18, few month.

whats ur problem?

what the hells a php forum for if i cant write my questions down!

:!:
 
hello moody moderator

looked it up, found a way but doesnt work.

i enter

substr($news,0,90); where the code will be displayed and all it displays is


substr(the actual news statement from my database.,0 , 90);

any help, or SORRY for troubling you.
 
2AaaDee & Wizard
Ani conflicts in at the my teritory!

Way 2.

$string=explode("", $news);

for ($d=0; $d < "90"; $d++)
{
echo $sting[$d];
}


ond one wore... Adam, you are very new in PHP, so please read this thread and (may be) you will be programing more better...
 
AaaDee said:
hello moody moderator

looked it up, found a way but doesnt work.

i enter

substr($news,0,90); where the code will be displayed and all it displays is


substr(the actual news statement from my database.,0 , 90);

any help, or SORRY for troubling you.
It sounds to me like you're not using the function correctly. Have you surround them in quote tags? If you have PHP won't see the function as a function, it'll just see it as normal text.

For example:
Code:
<?
print "This story: substr($news,0,90);";
?>

This is wrong because PHP is interpreting the substr as a string, and not a function. The correct procedure is:
Code:
<?
print "This story: ".substr($news,0,90);
?>

Now the function is being processed by PHP instead of being interpretted as a string in itself. This should hopefully fix your problem.

:D
 
Back
Top