ID: 26187 Updated by: [EMAIL PROTECTED] Reported By: matt at 1lsn dot com -Status: Open +Status: Bogus Bug Type: MySQL related Operating System: Slackware 8.1 PHP Version: 4.3.4 New Comment:
var_dump(mysql_num_rows($Result)); will infact return int(0); Previous Comments: ------------------------------------------------------------------------ [2003-11-09 19:22:58] matt at 1lsn dot com Description: ------------ when doing a mysql_num_rows, if there are no matching rows it gives an error instead of returning 0. Reproduce code: --------------- $Query = "SELECT * FROM MyTable WHERE Field1 = '1' and Field2 = '2' "; $Result = mysql_query($Query) or die("Error101: ". mysql_error()."<BR>".$Query); $CNT = mysql_num_rows($Result) OR DIE("Error 102: "."<BR>".mysql_error()."<BR>".$Query."<BR>"); echo "There are ".$CNT." matching results. "; Expected result: ---------------- $CNT should be set to '0' and page should display "There are 0 matching results." Actual result: -------------- Error 102: SELECT * FROM MyTable WHERE Field1 = '1' and Field2 = '2' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26187&edit=1