Limit text

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pagegen
Forum Commoner
Posts: 32
Joined: Sat May 31, 2008 6:38 am

Limit text

Post by pagegen »

hey guys, i have another qustion :)

In my MYSQL database i have a field called description.. it can have words up 500..

when i read this field i just want to limit the words to 250. is that possible?

here is my current code, all it does it read the hole row

Code: Select all

 
#                 Echo $row[dec] ;
 
thanks in advanced
User avatar
Mds
Forum Contributor
Posts: 110
Joined: Tue Apr 22, 2008 8:56 pm
Contact:

Re: Limit text

Post by Mds »

See substr
For an example :

Code: Select all

 
<?php
echo substr($row[dec], 0, 250);
?>
pagegen
Forum Commoner
Posts: 32
Joined: Sat May 31, 2008 6:38 am

Re: Limit text

Post by pagegen »

Mds wrote:See substr
For an example :

Code: Select all

 
<?php
echo substr($row[dec], 0, 250);
?>
u guys are the best man :) thanks

can i give u rep or smet 4 helping?
Post Reply