RE: [PHP] $result = mysql_query($query);

From: Date: Sat, 14 Sep 2002 19:05:17 +0000
Subject: RE: [PHP] $result = mysql_query($query);
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-116395@lists.php.net to get a copy of this message
> $query = "SELECT * from TABLE WHERE CHAMP = 'truc' order by NO LIMIT > 0,10"; > $result = mysql_query($query); > > what i'm trying to do is if the result is !=0 echo the result else echo > nothing > i tried this OK, let's think about this. You want to show a result if rows are returned... So... if($row = mysql_fetch_array($result)) { do { //do whatever }while($row = mysql_fetch_array($result)); } else { //no results } That'll work fine. Or use mysql_num_rows(), like others suggested. ---John Holmes...

« previous php.general (#116395) next »