> "Ryan A" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi, > > I have this simple code in my php script: > > > > * * * * * > > $res = mysql_query("SELECT product_id, now()-1 > FROM ".$tc."_prods where > > cno=$cno AND product_id='$product_id' LIMIT 1"); > > > > if($res) > > { > > $r = mysql_fetch_row($res); > > $product_id2 = $r[0]; > > $th_pres= $r[1]; > > echo "debug echo"; > > }else {echo "No results, sorry";} > > * * * * * > > > > its working great when the data actually exists > but when there are no > > matches it still executes the "if($res)" part > instead of > > displaying "No results, sorry". > > Why is that? or am I using the syntax wrong? > > > > Thanks, > > -Ryan
Thanks guys, I'm now using: if(($r = mysql_fetch_row($res)) >=1) and its working fine, if the above approach has some problems, feel free to write and tell me. Cheers, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php