mysql_fetch_array不就是获取一行数据吗 为什么获取不到 还提示这个内容
( ! ) Warning: mysql_fetch_array() expects parameter 1 to be resource, object given in D:\wamp\www\chaxun.php on line 5
<?php
$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();
谢谢