SELECT SUBSTRING_INDEX(field, ' ', 25) FROM tablename

Edward Dudlik
Becoming Digital
www.becomingdigital.com


----- Original Message -----
From: "Adam Clauss" <[EMAIL PROTECTED]>
To: "'Steve Marquez'" <[EMAIL PROTECTED]>; "'MySQL List'"
<[EMAIL PROTECTED]>
Sent: Wednesday, 28 May, 2003 22:07
Subject: RE: Limiting words...


Maybe this:
SUBSTRING_INDEX(str,delim,count)
Returns the substring from string str before count occurrences of the
delimiter delim. If count is positive, everything to the left of the final
delimiter (counting from the left) is returned. If count is negative,
everything to the right of the final delimiter (counting from the right) is
returned:
mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2);
        -> 'www.mysql'

Except do with sapces instead of period?

Adam Clauss
[EMAIL PROTECTED]


> -----Original Message-----
> From: Steve Marquez [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 28, 2003 8:49 PM
> To: MySQL List
> Subject: Limiting words...
>
>
> Hi all,
>
> I have articles that I wish to display on a site. They are
> contained in long
> text fields in a MySQL table.
>
> I would like to display the first 25 words in the article, then have a
> "continued" link to the rest of the article on another page.
>
> I am using PHP on my pages currently.
>
> Anyone know how to accomplish this?
>
> Thanks for your help.
>
> -Steve Marquez
> Marquez Design
>
www.marquez-design.com
[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to