note 16945 deleted from control-structures.while by zak
| From: | zak@php.net | Date: | Tue, 20 Nov 2001 02:36:54 +0000 |
| Subject: | note 16945 deleted from control-structures.while by zak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-21043@lists.php.net to get a copy of this message | ||
I was looping through some results from my DB and wanted to tell the user if there were no results,
so I wrote this:
$i = 1;
while ($record = mysql_fetch_array($result)) {
print "\t\t $record[0] \n";
$i = $i + 1;
}
//i = 1 if there were no results because we never went through the loop
if ($i==1){
echo "<em>no results</em>";
}