Description:
Hello All,
I'm trying to execute a insert query in my PHP script. This will happen in POST method after submitting data. After few cross checkings script will saves the information in database table.And the database type default type. When ever i'm clicking submit button this insert query executing twice. Ths syntax of the insert query is as follows...
$insertQuery = "INSERT INTO serveractivations (associateid,databaseusername,associatename,doj,doa,dop,associatepaidamount,miles,orderid,mop,ddnumber,dddate,bankname,remarks,sessionagentid,excessamount,regionaloffice,invoicenumber,creditamount,payment,nomineename,nomineesex,nomineerelation,nomineeaddress,nomineecity,nomineedob,activationtype,activatedtime) VALUES ('$associateId','$databaseUserName','$associateName','$doj','$doa','$dop','$associatePaidAmount','$miles','$orderid','$mop','$ddNumber','$ddDate','$bankName','$remarks','$sessionAgentId','$excessAmount','$regionalOffice','$invoiceNumber','$creditAmount','$payment','$nomineeName','$nomineeSex','$nomineeRelation','$nomineeAddress','$nomineeCity','$nomineeDob','1',now())";
$insertResult = mysql_query ($insertQuery) or die ("Insert Query Error<BR>$insertQuery<BR>Error:".mysql_error());
In the table definition first i didn't mentioned any unique key. So, it was inserting 2 entries. After i made associateid as unique. Then after it is giving duplicate key error. Please help me in this regard.
How to repeat:
Hello All,
I'm trying to execute a insert query in my PHP script. This will happen in POST method after submitting data. After few cross checkings script will saves the information in database table.And the database type default type. When ever i'm clicking submit button this insert query executing twice. Ths syntax of the insert query is as follows...
$insertQuery = "INSERT INTO serveractivations (associateid,databaseusername,associatename,doj,doa,dop,associatepaidamount,miles,orderid,mop,ddnumber,dddate,bankname,remarks,sessionagentid,excessamount,regionaloffice,invoicenumber,creditamount,payment,nomineename,nomineesex,nomineerelation,nomineeaddress,nomineecity,nomineedob,activationtype,activatedtime) VALUES ('$associateId','$databaseUserName','$associateName','$doj','$doa','$dop','$associatePaidAmount','$miles','$orderid','$mop','$ddNumber','$ddDate','$bankName','$remarks','$sessionAgentId','$excessAmount','$regionalOffice','$invoiceNumber','$creditAmount','$payment','$nomineeName','$nomineeSex','$nomineeRelation','$nomineeAddress','$nomineeCity','$nomineeDob','1',now())";
$insertResult = mysql_query ($insertQuery) or die ("Insert Query Error<BR>$insertQuery<BR>Error:".mysql_error());
In the table definition first i didn't mentioned any unique key. So, it was inserting 2 entries. After i made associateid as unique. Then after it is giving duplicate key error. Please help me in this regard.