php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11859 Insert queries add TWO records to database
Submitted: 2001-07-03 11:39 UTC Modified: 2001-08-10 18:44 UTC
From: john at neutralize dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.6 OS: WinNT4
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: john at neutralize dot com
New email:
PHP Version: OS:

 

 [2001-07-03 11:39 UTC] john at neutralize dot com
All my insert queries seem to add two records to the database instead of one.

I was using MS Access 2000 and did not have the problem. I am now using MySQL and all insert queries add 2 recs?!

Eg.

$sql = "INSERT INTO Campaign (CampaignName,CampaignDesc,StartDate,EndDate,CompanyId,CampaignStatus,AdministratorId) VALUES ('$name','$desc','$start_date','$end_date',$company_id,0,1)";

$res_insert_campaign=mysql_query($sql,$conn);

if (!$res_insert_campaign) {
  return false;
}

With the result:

CampaignId	CompanyId	AdministratorId	CampaignName	CampaignDesc	StartDate	EndDate	ProposalPDF	InvoicePDF	CampaignStatus	
----------	---------	---------------	------------	------------	---------	-------	-----------	----------	--------------	
11	45	1	Test All	testing	2001-07-03	2003-07-03	NULL	NULL	0	
12	45	1	Test All	testing	2001-07-03	2003-07-03	NULL	NULL	0	

(2 row(s) affected)

A guy in the US seems to be having the same problem with Sybase.  His details are:

Rob Donat
Sedonatech, Inc.
1735 W. Diversey Suite 521
Chicago, IL 60614
rdonat@sedonatech.com
312-501-1200 cell
773-388-0271(2) office(fax)

Do u know if this is a PHP, MySQL, ODBC or server setting bug?

My fix at the moment is to insert a record, select it and delete one if 2 are added.

This is very messy and I would like to know if I have to go back to Access or start using another relational database?

Does anyone else have this problem or, preferebly, how do I fix it?

Thank you for any help.

mailto:john@neutralize.com

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-10 17:49 UTC] elixer@php.net
Submitted twice (See bug #11858)
 [2001-08-10 18:44 UTC] sniper@php.net
Correct status is 'bogus'. 


 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Feb 09 13:03:40 2023 UTC