0
請幫助我。 PHP在boolean'`調用成員函數fetch()布爾型(xampp)
$sql = $pdo->prepare("select id,name,biography from authors where id=?");
$data = array($_POST['id']);
$result = $sql->execute($data);
$str=$result->fetch(PDO::FETCH_ASSOC);`
返回我的錯誤「調用一個成員函數取()查詢作出成功,因爲 的var_dump($結果)=布爾(真)。
同樣的結果我有: $sql = $pdo->prepare("select id,name,biography from authors where id=:id"); $result = $sql->execute(array(':id'=>$_POST['id'])); $str=$result->fetch(PDO::FETCH_ASSOC);
查詢
$pdo->query("select id,name,biography from authors");
有人成功