Bug #11858 Updated: Insert queries add TWO records to database

From: Date: Wed, 21 Nov 2001 09:19:15 +0000
Subject: Bug #11858 Updated: Insert queries add TWO records to database
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-71184@lists.php.net to get a copy of this message
ID: 11858
User updated by: john@neutralize.com
Reported By: john@neutralize.com
Old Status: Feedback
Status: Closed
Bug Type: MySQL related
Operating System: WinNT4
PHP Version: 4.0.6
New Comment:

The problem was in the javascript, form submiting twice

Previous Comments:
------------------------------------------------------------------------

[2001-11-20 19:40:23] mfischer@php.net

Can you try if this problem persists with latest RC

http://phpuk.org/~james/php-4.1.0RC3-win32.zip

Also, please provide more details abour your actual connections setup to the database (native mysql,
mysql through odbc?)

Feedback.

------------------------------------------------------------------------

[2001-07-03 11:38:47] john@neutralize.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

------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=11858&edit=1



Thread (2 messages)

« previous php.dev (#71184) next »