[PHP-DB] If select query doesn't net any results

2003-01-09 Thread Michael Cortes
I am a programming novice and just created my first php application. However I have a situation I don't know the answer to. My db queries (mysql) are written like this: $qtrans= select * from $table where (conditionals) order by some field; $link=mysql_connect ($host, $user,

RE: [PHP-DB] If select query doesn't net any results

2003-01-09 Thread Ryan Jameson (USA)
if (mysql_num_rows($result) 1) { //do stuff } This is only this easy with mySQL... :-) Ryan -Original Message- From: Michael Cortes [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 09, 2003 11:07 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] If select query doesn't net any results

Re: [PHP-DB] If select query doesn't net any results

2003-01-09 Thread Chris Boget
I would like to created an if statement that only occurs if the query gets a result. If there are no records that meet the query conditionals and my array ends up with null, I do not want my if statement to take place. Is this easy enough to do? Any help would be great. if(

Re: [PHP-DB] If select query doesn't net any results

2003-01-09 Thread Doug Thompson
... if ($result) { while ($row... ... } $result will be 0 (false) if nothing satisfies the query. Any other comparison is just extra typing with no improvement in logic. Regards, Doug On Thu, 09 Jan 2003 13:06:51 -0500, Michael Cortes wrote: I am a programming novice

RE: [PHP-DB] If select query doesn't net any results

2003-01-09 Thread John W. Holmes
... if ($result) { while ($row... ... } $result will be 0 (false) if nothing satisfies the query. Any other comparison is just extra typing with no improvement in logic. No, it only returns false/0 if the query fails, meaning there was an error and the query couldn't be