RE: [PHP] still stuck / newbie, simple problem / question
| From: | Greg Wiley | Date: | Wed, 30 Apr 2003 10:48:42 +0000 |
| Subject: | RE: [PHP] still stuck / newbie, simple problem / question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145754@lists.php.net to get a copy of this message | ||
- wrote:
> I should have mentioned before, I am getting the string
> information from an array built from the result sent back from DB.
>
> $query2 ="SELECT topic, lastPost FROM forumThreads WHERE
> userID = $userID"; $result2 = @mysql_query($query2);
>
> $user = @mysql_fetch_array($result2);
>
> $topic = $user['topic']substr($topic, 0, 20)."..."; <<<
> this line dosent work //what i currently have $topic =
> $user['topic']; I want to shorten 'topic' before it is output.
>
Try:
$topic = substr($user['topic'], 0, 20);
$topic .= "...";
Cheers, Greg.