Page 1 of 1

Limit text

Posted: Tue Sep 02, 2008 4:11 pm
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

Re: Limit text

Posted: Tue Sep 02, 2008 4:22 pm
by Mds
See substr
For an example :

Code: Select all

 
<?php
echo substr($row[dec], 0, 250);
?>

Re: Limit text

Posted: Tue Sep 02, 2008 4:30 pm
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?