...

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



tsclan
09-15-2005, 01: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, 01:50 AM
SELECT
SUBSTRING_INDEX(yourcol,' ',20) AS foo
FROM
table


That'll extract everything up to the twentieth space.

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum