php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45979 Select and Delete Mysql
Submitted: 2008-09-03 06:28 UTC Modified: 2008-09-03 07:07 UTC
From: d dot durieux at siprossii dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.2.6 OS: FreeBSD 7.0 AMD64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: d dot durieux at siprossii dot com
New email:
PHP Version: OS:

 

 [2008-09-03 06:28 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-03 06:30 UTC] d dot durieux at siprossii dot com
It's on FreeBSD 7.0 i386 and not AMD64
 [2008-09-03 07:07 UTC] tularis@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 09:01:27 2024 UTC