I have this code. Running it directly it is supposed to return 100. But with this code it returns 1. Do I use the ? wrong or why does it return just 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);
?>