MySQL making a double entry on INSERT?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

MySQL making a double entry on INSERT?

Post 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
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

No, it isn't. Could you make a test case?
mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

Post 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.
Post Reply