RE: [PHP-DB] checking for results return from mysql

From: Date: Sun, 05 Aug 2001 17:19:44 +0000
Subject: RE: [PHP-DB] checking for results return from mysql
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-11080@lists.php.net to get a copy of this message
try this $result = mysql_query($sql_query); if ($result) { while ($row = mysql_fetch_array($result)) { $var_1 = $row['var_1']; $var_2 = $row['var_2']; } } olinux -----Original Message----- From: Jon Yaggie [mailto:dmsales@design-monster.com] Sent: Sunday, August 05, 2001 1:36 PM To: php-db@lists.php.net Subject: [PHP-DB] checking for results return from mysql i suppose this much have a simple solution i am missing. but here is the situation. i want to checkand see if my query returned any results. problem is if i check liek this - if($results = mysql_fetch_array($result)) it appears that a resource is returned regardless. so this is always true. the real problem is that i need to find out if something is returned without actually accessing the data. because this if statement appears to be calling the first row of result data so later when i use a while loop to go through the data i am missing the first result returned. i have tried putting a few other mysql function in the conditional. maybe i am on the wrong path . . would one of the cariable functions like isset() or soemthing check this? Thank You, Jon Yaggie www.design-monster.com And they were singing . . . '100 little bugs in the code 100 bugs in the code fix one bug, compile it again 101 little bugs in the code 101 little bugs in the code . . .' And it continued until they reached 0 _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com

« previous php.db (#11080) next »