怎么样获取一行数据呢和所有的数据的行数呢?

我加上了 $myrow = mysql_fetch_row($res);这一句想获取一行数据 为什么获取不到一行 提示这个 ( ! ) Warning: mysql_fetch_row() expects parameter 1 to be resource, array given in D:\wamp\www\chaxun.php on line 7

<?php
 $pdo=new PDO("mysql:host=localhost;dbname=t1","root","");
 $stmt=$pdo->prepare("select * from test");
 $stmt->execute();
 //$myrow = mysql_fetch_row($stmt->execute());
 $res=$stmt->fetch();
 $myrow = mysql_fetch_row($res);
 print_r($myrow);
?>
阅读 6.5k
2 个回答

要用while循环取吧

推荐问题