dimanche 28 décembre 2014

DBO execute returns true but doesn't execute


I am having a bit of trouble with some of my code. This is the code:


$STMT3 = $PDO->prepare('


INSERT INTO lotteries_entries (steamID, lottery_id) VALUES (:STEAMID, :ID);



UPDATE `lotteries_entries` SET `winner` = 1 WHERE `lottery_id` = :ID ORDER BY RAND() LIMIT 1;

UPDATE `lotteries` SET `status` = 1 WHERE `id` = :ID;

INSERT INTO `lotteries` (status, type) VALUES (0, :TYPE);'


);


$STMT3->bindParam(':STEAMID', $_SESSION['STEAM_steamid'], \PDO::PARAM_INT);


$STMT3->bindParam(':ID', $result['id'], \PDO::PARAM_INT);


$STMT3->bindParam(':TYPE', $result['type'], \PDO::PARAM_INT);


$STMT3->execute();


Although the $STMT3 returnes true (by using var_dump to check it), it unfortunatly never Inserts or Updates any of the tables it was told to. I've tried to run the script on the MySQL "SQL" tab (Directly through SQL) and it work fine. No errors are thrown through the script, and the SQL code isn't problematic.


Please not i use transactions, and yes i have started an commited the transaction. Both start and commit is reached by the script without any difficulty.


To see the whole code please visit: https://gist.github.com/vasil7112/8913f002940aaeb2f682


Kind regards and wish you have had a wonderful year.





Aucun commentaire:

Enregistrer un commentaire