I use following code to bind parameters, but got still the message: The number of variables must match the number of parameters in the prepared statement
if (!isset ($_GET['token']))
{
echo "<p class='passed'>Link passed.</p>";
}
else
{
$stmt = $conn->prepare("UPDATE database SET is_verified = ? WHERE token = ?");
$status = 1;
$stmt->bind_param("s", $token);
$stmt->bind_param("i",$status);
$res = $stmt->execute();
if ($res)
{
echo "<p class='NewsStat'>You confirmed.</p>";
}
}
The $token value contains 100 characters.
Many thanks in advance!
>Solution :
You are not binding params correctly in your code.
if (!isset ($_GET['token']))
{
echo "<p class='passed'>Link passed.</p>";
}
else
{
$stmt = $conn->prepare("UPDATE database SET is_verified = ? WHERE token = ?");
$status = 1;
$stmt->bind_param("ss", $status, $token);
$res = $stmt->execute();
if ($res)
{
echo "<p class='NewsStat'>You confirmed.</p>";
}
}