Page 1 of 1

MySQL making a double entry on INSERT?

Posted: Thu Nov 27, 2003 10:11 am
by mikebr
I seem to have a strange problem where I am getting a double entry when running the following MySQL INSERT query...

Code: Select all

<?php
$query = "INSERT INTO this_table (client, page, title, text, right_left, num)
               VALUES ('$client', '$page', '$title', '$text', '$right_left', '$num')";
?>
Is this a normal problem with MySQL? and if so how do I cover for it?

Thanks

Posted: Thu Nov 27, 2003 11:38 am
by Weirdan
No, it isn't. Could you make a test case?

Posted: Thu Nov 27, 2003 12:24 pm
by mikebr
Got it,

I was copying and pasting code to set the queries, I found I had the following after the query:

Code: Select all

<?php
$mysql_result=mysql_query($query,$connection);
$num_rows-@mysql_num_rows($mysql_result);
?>
must have copied a SELECT query and forgot to remove those lines after changing it to an INSERT, this was obviously running the query a second time.