I have write simple code in PHP, I'm a beginner in this language.
This is my code:
$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;
}
}
My problem is that the cycle while is never executed, but I don't understand why. Thanks in advance.