Re: Truncating text
| From: | Dimitris Kossikidis | Date: | Tue, 04 Mar 2003 13:44:40 +0000 |
| Subject: | Re: Truncating text | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138100@lists.php.net to get a copy of this message | ||
Just run this query avoiding all this php code
SELECT SUBSTRING( MyFieldName, 0, 30 ) FROM MyTable
Substring( fieldname, starting position, length )
"Sebastian" <sebastian@dslr.net> wrote in message
news:001101c2e254$5e3c1000$b0a13f44@level3...
> Good morning all.
>
> I have a mysql query that fetches some text. I am limiting the results to
> two (2).
>
> Then i am limiting the text to 30 characters and truncating it with some
> "...." Like this:
>
> if(strlen($title) >= 30) {
> $title = substr(trim($title),0,30);
> $title = $title.'..';
> }
>
> But when a $title contains a ! (exclamation point) it only shows one
result.
> Why is an ! interfering?
>
> Any suggestions?
>
> warm regards,
> Sebastian - [BBR] Gaming Clan
> http://www.broadbandreports.com
>