Heim > Artikel > Backend-Entwicklung > 这样写为什么获取不到数据?
mysql_fetch_array不就是获取一行数据吗 为什么获取不到 还提示这个内容
( ! ) Warning: mysql_fetch_array() expects parameter 1 to be resource, object given in D:\wamp\www\chaxun.php on line 5
$pdo=new PDO("mysql:host=localhost;dbname=t1","root","");
$stmt=$pdo->prepare("select * from test");
$stmt->execute();
$myrow = mysql_fetch_array($stmt);
print_r($myrow);
?>
$myrow = mysql_fetch_array($stmt);
应为
$myrow = $stmt->fetch();
xi
$myrow = mysql_fetch_array($stmt);
应为
$myrow = $stmt->fetch();