php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15085 mysql_query for insert statement does not work proprely
Submitted: 2002-01-17 10:50 UTC Modified: 2002-01-18 08:02 UTC
From: a dot chine at criltechnology dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.5 OS: Linux Redhat 7.1
Private report: No CVE-ID: None
 [2002-01-17 10:50 UTC] a dot chine at criltechnology dot com
I have wrote the script bellow :

for ($i=50;$i<60;$i++)
{
$requette="INSERT INTO DRE(cle_DRE,nom) VALUES(".$i.",'DRE".$i."')";
$resultat=mysql_query($requette,$connexion);
if ($resultat==FALSE)
  {echo "Erreur : ".mysql_error()."<br>"; return -1;}
}

the field "cle_DRE" is the primary key of the table "DRE".
in the beggining, the table is empty, and when trying to execute this script, the behavior is random, sometimmes it works proprely, and the rows are added to the table, other times, it generates an error message : Erreur : Duplicate entry '50' for key 1.
before lunching the script, i always initialise the table (i make it empty).
thanks for help::))

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-17 13:45 UTC] sander@php.net
Ask support questions on the appropriate mailinglist.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 08:01:30 2024 UTC