User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 402,003 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,414 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 974 | Replies: 1
Reply
Join Date: Jul 2007
Posts: 1
Reputation: devknob is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
devknob devknob is offline Offline
Newbie Poster

Question INSERT INTO doing double duty

  #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

if($uid > 0 && $id != $uid){
include('connection.php');
mysql_query("INSERT INTO history SET uid='$uid', pro='$id'"); }

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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2006
Posts: 217
Reputation: katharnakh is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 19
katharnakh's Avatar
katharnakh katharnakh is offline Offline
Posting Whiz in Training

Re: INSERT INTO doing double duty

  #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 2:19 am.
challenge the limits
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MySQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 9:13 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC