Hi,
Im using a lookup function to get a relevant object by ID like;
$val=(search string as integer);
$sqlQuery = new SQLQuery("COUNT(myObject.ID)","myObject","ID=".intval($val));
if($sqlQuery->execute()->value()){
return DataObject::get_by_id('myObject', intval($val));
}else{
Director::redirect('/myObjectSearchPage/');
}
but instead of being redirected the function is returning null and I get;
[Notice] Trying to get property of non-object
Any ideas?