Thanks for that. I ended up using your method as using the LEFT function in a 
SELECT only grabs characters.

Cheers,

Jord

On Monday 06 August 2001 17:37, you wrote:
> You can do this several ways... Either use explode():
> http://www.php.net/manual/en/function.explode.php
>
> ...to split the retrieved data by a space " " as the delimeter, then use
> a for() loop to print X number of words... E.g.:
>
> $array = explode(" ", $db_string);
>
> for($i = 0; $i < 25; $i++)
>       echo $array[$i];
>
> (That will print the first 25 words...)
>
>
> Or, another way to do it is to use strtok() to tokenize the string...
> http://www.php.net/manual/en/function.strtok.php
>
> The manual has a good example of tokenizing a string into individual
> words...
>
>
> -----Original Message-----
> From: Jordan Elver [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 06, 2001 5:20 PM
> To: PHP General Mailing List
> Subject: [PHP] Splitting Text
>
>
> Hi,
> Can anyone give some pointers for my problem.
> I want to pull articles out of a db and then show the first x number of
> words
> with a read more link to the rest of the article.
>
> Could someone point me in the right direction. I've seen a code snippet
> for
> this, but now I can't find it :-(
>
> TIA,
>
> Jord

-- 
Jordan Elver
Web Developer
The InternetOne UK Ltd

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to