PHP PDO left join not giving the same results as in mysql direct -
mysql server:
if execute following sql statement on mysql server directly all games usertogame entrys or null values if not existent.
select g.*, ug.id_usertogame, ug.id_user, ug.nickname, ug.server games g left join usertogame ug on g.id_game=ug.id_game , ug.id_user=11 order g.id_game
php pdo:
but if run following pdo statement in php games usertogames entry exists (without null values, in normal join). first thougt pdo doesnt support left join found many exaples wich prove does.
function getusergames($uid) { $stmt = self::$_db->prepare("select g.*, ug.id_usertogame, ug.id_user, ug.nickname, ug.server games g left join usertogame ug on g.id_game=ug.id_game , ug.id_user=:uid order g.id_game"); $stmt->bindparam(":uid", $uid); $stmt->execute(); return $stmt->fetchall(pdo::fetch_assoc); }
-> $uid = 11
follownig statement logged mysql server (sql logging):
35 query select * games g join usertogame ug on g.id_game=ug.id_game , ug.id_user='11'
why left join not work in pdo?
Comments
Post a Comment