From: [EMAIL PROTECTED] Operating system: Debian Linux 2.4.10 PHP version: 4.1.1 PHP Bug Type: MySQL related Bug description: occasioanlly no result returned
We moved our server from FreeBSD/PHP 4.0.6/Apache 1.3.20 to Debian/PHP 4.1.1/Apache 1.3.22. Now we are occasionally receiving the following warning for mysql_num_rows: PHP Warning: 6 is not a valid MySQL result resource in /usr/local/webhosts/default/test.php on line 40 sometimes number 6 changes to 25, 38 etc. I could not figure out under which conditions it happens as most of the time when page is refreshed it disappears. It happens on many pages and probability of having warning increases as number of queries in the page increases. When that warning received there are no other errors or warnings. Also there is no result assosciated for the recordset that mysql_num_rows using although there should be and other recordsets are working fine. I tried to reproduce the error with the following script and I managed to get a bunch of them. Approximately I got 9 warnings for 100 execution of the script. All executions are identical and warnings seemed to happen randomly. Here is the script that I used for testing. The query returns 3 rows normally: <? $dbHost = "192.168.10.12"; $dbUser = "phpuser"; $dbPass = "passwd"; $dbName = "sb"; //Server Connection if(!($dbLink = mysql_pconnect($dbHost,$dbUser,$dbPass))) { print("Failed to connect to database!<BR>\n"); exit(); } //select database if(!mysql_select_db($dbName,$dbLink)) { print("Can't use database!<BR>\n"); exit(); } for($i=0;$i<20;$i++) { $qryCompare = "SELECT * FROM sb_Compare WHERE constant = 11 AND variant = 10;"; if(!($recCompare=mysql_query($qryCompare, $dbLink))) { print("Query error!...<BR>\n"); print("MySQL say : " . mysql_error() . "<BR>\n"); print("Query was : $qryCompare<BR>\n"); exit(); } $qryCompar = "SELECT * FROM sb_Compare WHERE constant = 11 AND variant = 10;"; if(!($recCompar=mysql_query($qryCompar, $dbLink))) { print("Query error!...<BR>\n"); print("MySQL say : " . mysql_error() . "<BR>\n"); print("Query was : $qryCompar<BR>\n"); exit(); } echo mysql_num_rows($recCompare); echo mysql_num_rows($recCompar); } ?> -- Edit bug report at http://bugs.php.net/?id=15417&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=15417&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=15417&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=15417&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=15417&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=15417&r=support Expected behavior: http://bugs.php.net/fix.php?id=15417&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=15417&r=notenoughinfo -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php