美文网首页
PDO中遍历结果集的注意事项

PDO中遍历结果集的注意事项

作者: Jacqueline_JS | 来源:发表于2017-07-29 09:56 被阅读0次

--->在用foreach遍历结果集的时候,在foreach里面的声明的变量无需在foreach()语句之前声明

foreach($stmt as $row){
    $name=$row[0];
}
echo $name;

--->在mysql中发现select * from test where id=3和select * from test where id='3'都能查到相同的结果

相关文章

网友评论

      本文标题:PDO中遍历结果集的注意事项

      本文链接:https://www.haomeiwen.com/subject/vlpqlxtx.html