我有这个代码。直接运行它应该返回100。但是有了这个代码,它返回1。我是否使用 ?错了,或者为什么它只返回1?
<?php
require '../notWebsite/dbh.php';
session_start();
$userID = (int)$_SESSION['userID'];
$sqlCount = "SELECT COUNT(groupID) FROM savedbyuser WHERE userID = ?";
$stmt = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt, $sqlCount)) {
header("Location: ../GymnasieArbeteHemsida.php?error=countError");
exit();
}
else {
mysqli_stmt_bind_param($stmt, "i", $userID);
mysqli_stmt_execute($stmt);
$count = mysqli_stmt_execute($stmt);
echo $count;
exit();
}
mysqli_stmt_close($stmt);
mysqli_close($conn);
?>
白衣非少年