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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: a dot chine at criltechnology dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Thu Oct 10 13:01:26 2024 UTC