总结:PDO::query($sql)返回值是一个对象,其中包括了你输入的sql语句
而fetch()方法执行成功则返回包含一条记录的数组,失败返回false.
$rs = $pdo -> query("select * from {$tbname} order by id desc limit 1");
var_dump($rs);
$row = $rs -> fetch();
var_dump($row);
$rs = $pdo -> query("select * from {$tbname} order by id desc limit 1");
var_dump($rs);
$row = $rs -> fetch();
var_dump($row);