PHP gone wild: multiple inserts

Status
Not open for further replies.

HairyHun

Masturbating Bandit
Oct 11, 2007
576
2
0
Hey

I'm having a strange problem with PHP.

I have a lead capture script. For some reason it inserts 3 times the lead into my DB.

I only have the insert once in the code:

PHP:
$res = mysql_query($sQuery);

So how is this possible?


HH
 


Yes, definitely, this is not even the insert code.

::emp::
 
Here is the whole insert code:

PHP:
$sQuery = " INSERT INTO `v3` ( 

`id` ,
`FirstName`  ,
`LastName`  ,
`City`  ,

`Phone` ,
`Email`  ,
`Gender`  ,
`Citizenship`  ,
`Marital` ,
`Parent` ,
`AreaEduc` ,
`AreaHousing` ,
`AreaCC` ,
`CreditDebt` ,
`Status` ,
`TotalDebt` ,
`License` ,
`Goal` ,
`Contact` ,
`Year` ,
`Month` ,
`Day` ,
`Hour` ,
`Minute` ,
`Source` ,
`Keyword`

 )
				VALUES ('', 
				'".$FirstName."',
				'".$LastName."',
				'".$City."', 
				'".$Phone."', 
				'".$Email."', 
				'".$Gender."', 
				'".$Citizenship."', 
				'".$Marital."', 
				'".$Parent."', 
				'".$AreaEduc."', 
				'".$AreaHousing."', 
				'".$AreaCC."', 
				'".$CreditDebt."', 
				'".$Status."',			
				'".$TotalDebt."',
				'".$License."',
				'".$Goal."',
				'".$Contact."',
				'".$Year."',
				'".$Month."',
				'".$Day."',
				'".$Hour."',
				'".$Minute."',
				'".$Source."',
				'".$Keyword."'
										)";

$res = mysql_query($sQuery);


if (!$res) {
    die('Invalid query: ' . mysql_error());
  echo "error adding to table";
}
else
{	
}
 
Change mysql_query() to print(). See if it prints the query 3 times. If it does, it's a problem with your code (most likely some loop you're stuck in). Otherwise, something weird is going on with MySQL.
 
Change mysql_query() to print(). See if it prints the query 3 times. If it does, it's a problem with your code (most likely some loop you're stuck in). Otherwise, something weird is going on with MySQL.

i agree, maybe you inserted an injection code that made it insert 3 times..;) if it prints the correct sql statement, then isolate the database -- check if you have any triggers(problems with triggers is that the application does not know it exists, you get this evil at its best when you're just maintaining an application made by someone else b/c you don't know it exists either.)

hth
 
And here I was, thinking only fleshlights came with multiple inserts.

::emp::
 
Status
Not open for further replies.