working on a small project and having a small problem. i am querying mysql, i am able to get the array and everything works well but i am adding a additional condition if returns 0 or id does not match the query then redirect.
This is what i have so far.
$q = "SELECT TEST.*,
EMPLOYEE.EMP_ID
FROM TEST
LEFT JOIN EMPLOYEE ON TEST.EMP_ID = EMPLOYEE.EMP_ID
WHERE ITEM_ID=".$db->qstr($item_id);
if(!$item_id = $db->execute($q)){
force_page('system', 'Nothing found');
exit;
} else {
$view = $item_id->GetArray();
}
return $view;
}
so the above returns the array, query grabs $item_id from the url so it could be anything. i would like to check if that id exists if not then force the page as shown in the above. any suggestion on what i am doing wrong?