我想通过回显显示结果(“ Positio:2”或“ Position:1”),但$ statement是PDOStatement类的对象,而不是字符串,我如何让它仅查看$ statement的结果?谢谢
<?php
$pdo = new PDO('mysql:host=localhost;dbname=testdb1', 'root', '');
$idV = $_GET['id'];
$statement = $pdo->prepare("SELECT position FROM idtabelle WHERE idnumber = ?");
$statement->execute(array($idV));
echo "Position: //$result_Of_Statement\\ ";
?>
这是我的处理方式:
$statement = $pdo->prepare("SELECT position FROM idtabelle WHERE idnumber = :idV");
$statement->bindParam(':idV', $idV);
$statement->execute();
while ($row = $statement->fetch(PDO::FETCH_ASSOC))
{
echo $row['position'];
}
如果愿意,您也可以取消while循环。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句