伙计们,我对此有点问题
我有一个如下所示的选择语句
$stmt = $conn->prepare("SELECT * FROM Product WHERE id=:id");
$stmt->bindParam('id',$id);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if($row) {];
?>
<div> <?echo $row['Name']; >? </div>
<div> <?echo $row['Type']; >? </div>
$stmt1 = $conn->prepare("SELECT * FROM user WHERE Username IN ('john',
'sarah', 'james')");
$stmt1->bindParam('id',$id);
$stmt1->execute();
$row1 = $stmt1->fetch(PDO::FETCH_ASSOC);
if($row1) {];
?>
<div> <?echo $row1['username']; ?>' </div>
<? } ?> //closing for the second select statement
<? } ?> //closing for the first select statement
问题
页面渲染但我使用SELECT * FROM user WHERE Username IN ('john',
'sarah', 'james')
它的地方只显示一个名称而不是 3 个名称。
我知道 select 语句有效,因为我在 phpmyadmin 中尝试过,它确实显示了所有 3 个名称