这份准备好的声明有什么问题?我似乎无法让这个工作。
$session = mysql_real_escape_string($_GET['s']);
$stmt = $mysqli->prepare("SELECT quantity FROM details WHERE session = ?");
$stmt->bind_param( "s", $session);
$stmt->execute();
$stmt->bind_result($quantity);
当我echo $quantity;
时,结果只显示为0时,它应显示1到10之间的数字。
答案 0 :(得分:2)
$stmt = $mysqli->prepare("SELECT quantity FROM details WHERE session = ?");
$stmt->bind_param( "s", $session);
$stmt->execute();
$stmt->bind_result($quantity);
$stmt->fetch();
echo $quantity