Home > Backend Development > PHP Tutorial > 这样写为什么获取不到数据?

这样写为什么获取不到数据?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 13:19:22
Original
1042 people have browsed it

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();


谢谢
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template