Jump to content

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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.