View Full Version : How do you only show a certain number of words from the database

09-15-2005, 02:40 AM
I am just intergrating my forum into my home page. Well the announcements bit anyway. Although I cant exactly go and post an entire Story on my nice spacey forum and then expect it to appear nicely in a small little box with the heading "Updates".

Now I do want to show some text and not just the title of the post so it makes the "Read More" link Phychologically more clickable :p

So i was wondering am I able to only show something like 20 words using a PHP or MySQL (since its comming from a Database) function at all do you think.

Any ideas are welcome.
Thank you

Kid Charming
09-15-2005, 02:50 AM
SUBSTRING_INDEX(yourcol,' ',20) AS foo

That'll extract everything up to the twentieth space.

09-15-2005, 03:58 AM
Thank you very much