[eluser]artlover[/eluser]
Hi, here is my model. I want to display an upload form at view if there is no record. what can I return to controller for no record case? now i made a silly $data[] = 0. and i have no control at viewer to create an if condition for upload form :/
appreciate helps!! thanks
Code:
function get_img_id_record($id_work) {
$q_image = $this->db->getwhere('works_image', array('id_work' => $id_work));
if($q_image->num_rows() > 0) {
// record case
foreach ($q_image->result() as $row) {
$data[] = $row;
}
} else {
// no record case
$data[] = 0;
}
return $data;
}