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
News Pages
Moderators: egami, macek, gesf
- WiZARD
- Moderator
- Posts: 1240
- Joined: Thu Jun 20, 2002 10:14 pm
- Location: Ukraine, Crimea, Simferopol
- Contact:
AaaDee wrote: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.
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";


- WiZARD
- Moderator
- Posts: 1240
- Joined: Thu Jun 20, 2002 10:14 pm
- Location: Ukraine, Crimea, Simferopol
- Contact:
AaaDee wrote: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?
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";


- AaaDee
- New php-forum User
- Posts: 25
- Joined: Mon Jun 24, 2002 1:10 am
- Location: Huddersfield
- Contact:
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.
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.
-
- Last Samuray
- Posts: 824
- Joined: Sun Jun 02, 2002 3:09 am
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...
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 wrote: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: Select all
<?
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: Select all
<?
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.
