RE: [PHP] Displaying first 100 characters of an article

From: Date: Wed, 04 Oct 2000 05:59:50 +0000
Subject: RE: [PHP] Displaying first 100 characters of an article
Groups: php.general 
Request: Send a blank email to php-general+get-18519@lists.php.net to get a copy of this message
> Any ideas? Yup, see below. > <? > // connect to database here > $mySQL = "SELECT * FROM news order by date limit 4"; > $results = mysql_query($mySQL); > while ($myrow=mysql_fetch_array($results)) { // My added stuff $retstring = ""; > $stuff = "$myrow[message]"; > > if (strlen($stuff)<125) { > $retstring = $retstring . $stuff; > } > > else { > $retstring = $retstring . substr($stuff,0,125) . '...'; > } > print "$retstring"; > } > ?>

« previous php.general (#18519) next »