On Fri, 7 Mar 2003 10:22:01 -0800 (PST), Rahul.Brenda <[EMAIL PROTECTED]> wrote:

Glory & Supreme Power

What i'm looking to do is.. i want to display only the
first few words of the record in my mySQL database..

For example.. i have a table with a field "title"..
and let's say my last record has the value in title
field as

"This is going to be really cool"

What i want to display is

"this is going..."

Basically this is for News Headlines. I have a page
which displays news but on the first page of the site
i have to give the first few words of the last 4
articles in the news table..

How can i do this? I have seen this in a lot of places
but i dont know how to do this.

Thanks,
Rahul S. Johari


__________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/


Make mysql do the work for you.


select substring_index(title, ' ', 20), author from news order by date desc limit 4
// this particular string selects everything before the first 20 spaces of your title.


--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to