[eluser]solid9[/eluser]
Hi guys
I have these codes below,
controller:
Code:
function edit_show_r()
{
//capture product data
//fetch record where product is the index
if(isset($_POST['Edit'])) {
$product = $this->input->post('product');
$data['rows'] = $this->rmodel->show_record_prod($product);
$this->load->view('ahe_page2', $data);
}
}
model:
Code:
function show_record_prod($product) {
$this->db->select('prod_name, phase');
$this->db->from('products');
$this->db->where('prod_name', $product);
$q = $this->db->get();
if($q->num_rows() > 0) {
foreach ($q->result() as $row) {
$data[] = $row;
}
return $data;
}
else
{
//If record not found do something here.
}
}
This is just a simple query in the model.
Now in the model what is the right codes if the record is not found?
Or did not matched?
Thanks in advanced.