From: [EMAIL PROTECTED]
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