#45979 [Com]: Select and Delete Mysql
| From: | d dot durieux at siprossii dot com | Date: | Wed, 03 Sep 2008 06:30:39 +0000 |
| Subject: | #45979 [Com]: Select and Delete Mysql | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-128633@lists.php.net to get a copy of this message | ||
ID: 45979
Comment by: d dot durieux at siprossii dot com
Reported By: d dot durieux at siprossii dot com
Status: Open
Bug Type: MySQL related
Operating System: FreeBSD 7.0 AMD64
PHP Version: 5.2.6
New Comment:
It's on FreeBSD 7.0 i386 and not AMD64
Previous Comments:
------------------------------------------------------------------------
[2008-09-03 06:28:11] d dot durieux at siprossii dot com
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 this bug report at http://bugs.php.net/?id=45979&edit=1