Re: Newbie Question.. (MySQL/PHP)
| From: | David Robley | Date: | Fri, 07 Sep 2001 07:17:41 +0000 |
| Subject: | Re: Newbie Question.. (MySQL/PHP) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-66344@lists.php.net to get a copy of this message | ||
On Fri, 7 Sep 2001 16:49, nate@1feehosting.com wrote:
> Hey guys,
>
> I have a mysql database of articles, and what i'd like to do is make 1
> page that shows a brief sneak peak of each article, so what I would do
> is, show the first 50 or so words of each article and then add an
> elipses at the end. I'm sure it can be done but I wouldn't have a clue
> where to start. Any suggestions, or anyone ever done this?
>
> Thanks,
> Nate
Mysql has a substring function you could use to grab the first n
characters, then just concatenate the elippses when you display the
string.
With a little more effort, you could play around with substring_index to
display the first n words of the article.
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Happiness is a warm modem