php - PDO, fetchall and multiquery -


alright, i'm i'm doing isn't possible way i'm doing (i've been 2 days straight... again) possible run multiquery through pdo , return results... so?

$sql =  "select username, faction users uid = :uid;".  "select level, exp, health, luck, first_name, last_name player_information uid = :uid";      $que = $this->db->prepare($sql);     $que->bindparam('uid', $uid);     try{         $que->execute();         $row = $que->fetchall();         print_r($row);     }catch(pdoexception $e){$e->getmessage(); } 

or barking wrong tree?

yes, such "multiquery" called join:

select username, faction, level, exp, health, luck, first_name, last_name  users u, player_information pi u.uid = pi.uid , u.uid = :uid 

also, using wrong operators when calling it

$sql = "select username, faction, level, exp, health, luck, first_name, last_name          users u, player_information pi u.uid = pi.uid , u.uid = ?"; $stm = $this->db->prepare($sql); $stm->execute(array($uid)); $row = $que->fetch(); print_r($row); 

will give result in less code


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -