Jump to content

Insert occurs twice, no idea why!


shadowcaster

Recommended Posts

Hello.
I've been searching all over the internet for an answer to this problem but I'm still stuck. I have a table in my DB that was made with this code:

CREATE TABLE searches (id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, search VARCHAR(255) NOT NULL, datum DATE NOT NULL)

and I am using PHP to insert searches into it like so:
[code]<?php
$date = date('Y-m-d');
$queryW = "INSERT DELAYED INTO searches VALUES (NULL, '$search','$date')";
mysql_query($queryW) or print('Problem adding to Db: '.mysql_error()); ?>[/code]

But it inserts the same record twice and I have no idea why it does that. As far as I can see my php is sound and other inserts work fine. Please help.
Link to comment
https://forums.phpfreaks.com/topic/6195-insert-occurs-twice-no-idea-why/
Share on other sites

unfortunatly no, I've checked numerous times and I have made use of php's require_once() function and even placed it with other insert SQL commands and it still does the same thing. Every other insert works fine but this doesn't want to work. I have resorted to using the DISTINCT keyword in my queries to stop the doubling from displaying when I read from the database.
Are you sure it's inserting twice? Maybe the query you're using to look at the data is flawed (a missing join condition or something). Have you viewed the data with phpMyAdmin or something like that?

Just a thought.. I don't know where to go on this one, except maybe look through a much larger section of code.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.