One way to do it is to:

loop through the list of articles;
explode the body of article ==> $words = explode(" ", $body, 21);
$words is now an array of 21 elements, the first 20 elements contain the
first 20 words in the body, the 21st element contains the rest of the body;

Jason Wong
Gremlins Associates

> On my website I want to display some articles, in Slashdot style. The
> main page should only display the first 20 words of the article, and
> users should be able to click on a link to view the entire article.
> The articles are stored in a MySQL database, the body of the article in a
> blob-field.
> My question is this: how can I select only those first 20 words in the
> PHP code?
> I hope somebody can help me with this.
> Cilfa

PHP Database Mailing List (
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