Bug #16295: # is not a valid resource

From: Date: Tue, 26 Mar 2002 23:38:19 +0000
Subject: Bug #16295: # is not a valid resource
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-3429@lists.php.net to get a copy of this message
From: joyeux@1984.cz Operating system: MDK 8.2 PHP version: 4.1.2 PHP Bug Type: MySQL related Bug description: # is not a valid resource This SOMETIMES produces the error "3 is not a valid mysql resource on line 2" (or other numbers) First fetch_array is usually good. It looks like php forgot a resource link when calling other query. 1| $sql=mysql_query("SELECT id FROM tbl"); 2| while($row = mysql_fetch_array($sql, MYSQL_ASSOC)) { 3| mysql_unbuffered_query("DELETE FROM tbl2 WHERE 4| id=".$row["id"]); 5| } When I use an array to store data from tbl1 instead direct fetching, it works. 1| $ARR=array(); 2| $sql=mysql_query("SELECT id FROM tbl"); 3| while($row=mysql_fetch_array($sql, MYSQL_ASSOC)) $ARR[]=$row; 4| foreach($ARR as $row) mysql_unbuffered_query("DELETE FROM tbl2 WHERE id=".$row["id"]); I can't find where is the problem. I try to put some sleep() after mysql_query but it's the same. -- Edit bug report at http://bugs.php.net/?id=16295&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16295&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16295&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16295&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16295&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16295&r=support Expected behavior: http://bugs.php.net/fix.php?id=16295&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16295&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16295&r=submittedtwice

« previous php.bugs (#3429) next »