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

From: Date: Wed, 04 Oct 2000 05:08:03 +0000
Subject: RE: [PHP] Displaying first 100 characters of an article
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18521@lists.php.net to get a copy of this message
Worked great... thank you. At 03:59 PM 10/4/2000 +1000, Jason Murray wrote:
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"; } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.general (#18521) next »