PHP PDO left join not giving the same results as in mysql direct -


i have 2 db tables this: enter image description here

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 

enter image description here

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

enter image description here

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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -