I am calling this function from another page, but it gives me the below error: Warning: mysqli::prepare(): Couldn't fetch mysqli in
public function ResetTalentCandidate() {
// Get global vars
global $conn;
global $authUserId;
// Get post data
$candidateID = $_REQUEST['resetID'];
$statusUpdate = 0;
$dateReset = time();
if ($stmt = $conn->prepare ("UPDATE `rf_opportunitypool` SET pool_status = ? WHERE candidate_id = $candidateID;") or die (mysqli_error($conn))) {
// Bind values
$stmt->bind_param ('ii', $authUserId, $dateReset);
// Execute query
$stmt->execute();
// Close statment
$stmt->close();
// Successfully updated
return true;
}
// Nothing happened
return false;
}
I have similar functions elsewhere in my class but don't have the same problem. Could I be missing something somewhere?