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?