<?php
$dob = $_SESSION['dob'];
$month = $_SESSION['month'];
$s = $_POST['present'];
$p = "1";
if ($stmt = $mysqli->prepare("UPDATE atten SET total = ? WHERE name = ?"))
{
// Bind the variables to the parameter as strings.
foreach ($s as $name)
{
$stmt->bind_param("ss", $p, $name);
// Execute the statement.
$stmt->execute();
}
// Close the prepared statement.
$stmt->close();
}
This is the error message I'm getting when I try to execute the above code:
Call to a member function prepare() on a non-object.
Any ideas why?