Thread: mySQL Issue
View Single Post
  #1 (permalink)  
Old 01-14-2007, 08:29 PM
Sketch's Avatar
Sketch Sketch is offline
v7n Mentor
Latest Blog:
None

 
Join Date: 05-06-04
Location: London, UK
Posts: 664
iTrader: 0 / 0%
Sketch is a highly respected web proSketch is a highly respected web proSketch is a highly respected web proSketch is a highly respected web proSketch is a highly respected web proSketch is a highly respected web proSketch is a highly respected web proSketch is a highly respected web proSketch is a highly respected web proSketch is a highly respected web proSketch is a highly respected web pro
mySQL Issue

I've got a small issue with a mysql query.

I have a simply insert query

Code:
$eventId = $sql -> read($db, "SELECT eventId FROM division WHERE divisionId = '1'"); $reader = $sql -> bQuery("SELECT COUNT(userId) FROM team_player WHERE userId = '5' AND eventId = '".$eventId[0]['eventId']."' AND divisionId = '1'"); if($reader[0]['COUNT(userId)'] == 0) { $sql -> write("INSERT INTO team_player (userId, divisionId, eventId) VALUES ('5', '1', '".$eventId[0]['eventId']."')");
I read the database to make sure the user isn't already inserted into that table, if they aren't in there then insert them.

However for some reason every now and again I'm getting two of the same user appearing in the table, it is as if mySQL has decided to throw the same query 2 times, can this happen? If it can how do I stop it?
Reply With Quote