redirect if recordset empty not working
Hello,
I am trying to redirect to 404 page if recordset is empty.
Here is the query
$getdepartment = new WA_MySQLi_RS("getdepartment",$duck,1);
$getdepartment->setQuery("SELECT * FROM department WHERE id = ?");
$getdepartment->bindParam("i", "".(isset($_GET['id'])?$_GET['id']:"") ."", "-1"); //colname
$getdepartment->execute();
if ($totalRows_getdepartment == 0) { header("Location: https://www.mydomain.com/404.php"); }
Now redirect is working but even if the total row is not 0, it is still redirected.