10-22-2014, 12:45 PM
[eluser]alexandervj[/eluser]
I'm getting this error from my model. I'm pretty sure its because the function is looking in the database table for a row that doesn't exist. Is there a way to make it so that if the row its looking for doesn't exist it just returns $data['sent'] = 0? Here is my function in my model. It works great if the row its looking for is in the database
I'm getting this error from my model. I'm pretty sure its because the function is looking in the database table for a row that doesn't exist. Is there a way to make it so that if the row its looking for doesn't exist it just returns $data['sent'] = 0? Here is my function in my model. It works great if the row its looking for is in the database
Code:
function getSent(){
$this->db->where('submit_time', $this->uri->segment(3)); //
$tempsent = $this->db->get('0_request_details'); // here is the problem - if the function doesnt find the row that matches the line above it doesnt know what to do.
if($tempsent){
$sent = $tempsent->row();
$data['sent'] = $sent->is_sent;
}
return $data;
}