I have this function on my model, which receives a parameter so I can pre-load some information on the view page, but somehow is coming back empty:
function addTicket($idt)
{
//Db Connection
$DB2 = $this-> load-> database('DB2', TRUE);
if (!empty($idt)){
$query = $DB2->query ("
Select TROUBLE_ID, ASSIGNED_DATE, CREATOR, PROBLEM_DESCRIPTION, RESOLUTION, RESOLVED_DATE
FROM TABLE1
WHERE TROUBLE_ID = ".$idt."
");
if($query){
return $query->result_array();
}
else
{
echo 'No Queries to display';
}
}
else {echo 'No results to display';}
}
I have an Oracle DB with a ton of entries, but the query keeps coming back empty, Just in case I did an echo 'id:'.$idt.; to check if the ID is being passed. And yes it is.
Also Im getting this message:
Fatal error: Call to a member function result_array() on a non-object
On my view page i have this code:
foreach($results as $row){ }
And im getting this message now: A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Any idea why this is not working?