From: d dot durieux at siprossii dot com
Operating system: FreeBSD 7.0 AMD64
PHP version: 5.2.6
PHP Bug Type: MySQL related
Bug description: Select and Delete Mysql
Description:
------------
There is a problem when I select a line in mysql table and afet I delete
it.
Reproduce code:
---------------
It works :
$sql = 'SELECT * FROM sous_domaine WHERE id="10" ';
$req = mysql_query($sql) or die('Erreur SQL
!<br>'.$sql.'<br>'.mysql_error());
while($data = mysql_fetch_assoc($req)) {
echo $data['id'];
}
$sql2 = 'DELETE FROM sous_domaine WHERE id="10" ';
$req2 = mysql_query($sql2) or die('Erreur SQL
!<br>'.$sql2.'<br>'.mysql_error());
It don't work :
$sql = 'SELECT * FROM sous_domaine WHERE id="'.$_GET['id'].'" ';
$req = mysql_query($sql) or die('Erreur SQL
!<br>'.$sql.'<br>'.mysql_error());
while($data = mysql_fetch_assoc($req)) {
echo $data['id'];
}
$sql2 = 'DELETE FROM sous_domaine WHERE id="'.$_GET['id'].'" ';
$req2 = mysql_query($sql2) or die('Erreur SQL
!<br>'.$sql2.'<br>'.mysql_error());
Expected result:
----------------
In first case (it works) : I see the id get in mysql and it delete it
after
In second case (it don't work) : I don't see id get in mysql. It's like if
it delete it first and after select.
I have not error in php log.
--
Edit bug report at http://bugs.php.net/?id=45979&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45979&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45979&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45979&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45979&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45979&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45979&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45979&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45979&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45979&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45979&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45979&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45979&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45979&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45979&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45979&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45979&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45979&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45979&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45979&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45979&r=mysqlcfg