Limit Text length/word count

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
ijasont
Forum Newbie
Posts: 1
Joined: Fri Apr 11, 2003 3:42 pm

Limit Text length/word count

Post by ijasont »

I have large articles stored in my MySQL db and I want to only display 100 words from the top of each article in a 'list all articles page'.

How do I do this?

thanks for the help
Jason
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

you might use SUBSTRING(str,pos,len) to limit the number of characters returned.
http://www.mysql.com/doc/en/String_func ... ml#IDX1183
Post Reply