INSERT INTO doing double duty

Reply

Join Date: Jul 2007
Posts: 1
Reputation: devknob is an unknown quantity at this point 
Solved Threads: 0
devknob devknob is offline Offline
Newbie Poster

INSERT INTO doing double duty

 
0
  #1
Jul 30th, 2007
PHP version 5.1.6
MySQL version 5.0.27-standard-log

Table is super simple, 1 primary key, uid, unixtime(timestamp),blog, pro, bull, pix

  1. if($uid > 0 && $id != $uid){
  2. include('connection.php');
  3. mysql_query("INSERT INTO history SET uid='$uid', pro='$id'"); }
  4.  
  5. Thats all. Does anyone know why this would CREATE two identical records every TIME?
Anyone see why this would give me two of the same record every time its executed? I have several other inserts sitewide that dont have the same problem. I have other queries on other pages that dont duplicate the entry but insert into the same table.
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 237
Reputation: katharnakh is an unknown quantity at this point 
Solved Threads: 32
katharnakh's Avatar
katharnakh katharnakh is offline Offline
Posting Whiz in Training

Re: INSERT INTO doing double duty

 
0
  #2
Jul 31st, 2007
hi,
Anyone see why this would give me two of the same record every time its executed?
The query looks good. You might have problem with your code, the statements above if ($uid > 0 ... ). Probably a loop statement above it, check it thoroughly.

I dont think you have any problem with query. If you are still not satisfied with the query then try it out in MySQL console, executing the same SELECT statement, so that you can judge whether two records get inserted or one. You can do this as one of debug option.

kath.
Last edited by katharnakh; Jul 31st, 2007 at 3:19 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC