I have a class that sets a return to false if there is an error:
$delete = $database->select($sql);
if (!$delete) {
$database->print_last_error(false);
$database->print_last_query();
return false;
exit;
...
When I process that form, I want it to go back to the referring page if there is an error; otherwise, go to the main page.
$data = $newsHandler->deleteArticle($id);
$_SESSION['value_array'] = $_POST;
$_SESSION['error_array'] = $newsHandler->error;
if($data == false) {
//header("Location: main.php");
header("Location: ".$session->referrer."");
exit;
} else {
header("Location: main.php");
exit;
}
However, when I check for $data == false, it doesn't detect as false. When I try !$data, I believe the same thing happens. What should I be using to determine if the update to the database works or not? I thought if I returned false, then I could check for false.