Page 1 of 1

insert adding double entries

Posted: Sun May 28, 2006 7:05 pm
by pixienick
Hi all
I am getting strange behaviour from an insert statement to a simple table. I insert like;

Code: Select all

$InsertFav = "INSERT INTO favourites VALUES($AdID,$inID, 1,'')";
It keeps adding two records instead of one! At first it didnt have a unique id so i added one and it still adds two records with unique ids. I tried to hack around it deleting a record after with

Code: Select all

$delID = mysql_insert_id();
					
$deleteExtraFav = "DELETE FROM favourites WHERE id=$delID";
But that deletes 2 records too!
What am i doing?
Any help or advice much appreciated.

Posted: Sun May 28, 2006 7:48 pm
by timvw
Check your mysql log file... Usually this is due to some redirection in a script, which results in the fact that a script is executed twice...

Posted: Mon May 29, 2006 4:53 am
by twigletmac
If you add an echo statement just before or after the mysql_query() call you would be able to see if this was duplicated too. Check any loops the query is nested within.

Mac

Posted: Mon May 29, 2006 7:03 am
by pixienick
yeah i tried outputting text but that gave me no clues. Where might i find this mysql error log?
Cheers

Posted: Mon May 29, 2006 7:51 am
by raghavan20
try printing http referers from server variables.