$ stmt-> fetch()不能输入while

时间:2016-06-23 13:10:59

标签: php mysqli

我用PHP编写了简单的代码,我是这种语言的初学者。

这是我的代码:

$id = "prova";
$query = "SELECT DISTINCT id_item FROM Users WHERE id = ? LIMIT 1 ";


if ($stmt = $conn->prepare($query))
{
 $stmt->bind_param("s", $id);
 $stmt->execute();
 $stmt->bind_result($result);

 while ($stmt->fetch()) {
   $id_item = (int) $result;
 }

}

我的问题是,循环时间永远不会执行,但我不明白为什么。 提前谢谢。

0 个答案:

没有答案