Jump to content

Record being inserted twice?


lxndr

Recommended Posts

I'm sure I must be doing something incredibly dumb here but in certain circumstances when I call this particular php program I have written which is intended to insert a single record I find that instead it inserts the same record twice (there's no index field).  I don't know what to make of it, this is the actual code:

 

 

$today = time();                                                                                                                                                                                                                                                                                     

if (BST()==TRUE)  $today = $today + 3600;

$sql = "INSERT INTO stories_views  VALUES ( '$user_name', $rec_id, $today ) ";

$result = mysql_query($sql, $db)  or die(" - Failed More Information:<br><pre>$q</pre><br>Error: " . mysql_error());

 

The field types are as follows:

 

$user_name:  varchar

$rec_id:  int

$today:  int

 

 

It's starting to drive me nuts now so if anyone can suggest what the problem might be it'd be much appreciated.

 

Link to comment
Share on other sites

I can't see the code that well, stick it in between some [ code ] [ /code ] stuff.

 

However, as the recent reply says, try something like this:

 

$sql = "INSERT INTO stories_views (username,rec_id,today) VALUES ( '$user_name', '$rec_id', '$today') ";

 

Where username, rec_id, and today are the corresponding columns you want to add in. It may be something technical and picky o_o

Link to comment
Share on other sites

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.