this is taking me too long to figure out. I am using Codeigniter to query a database. The model does this
function currentfunction($id)
{
$query = $this->db->get_where('mytable', array("id =" => $id));
if($query->num_rows() > 0){
return $query->result_array();
}else {
return false;
}
}
Kontrolör
$this->load->model('Display');
$results = $this->Display->currentfunction($id);
$this->load->view('current_items', array('currentitems' => $results));
Görünümü
foreach($currentitems as $row){
echo $row['name']
///....do more
}
hiçbir satır döndürülür IF DIŞINDA sadece çalışıyor
o zaman
Message: Invalid argument supplied for foreach()...
Nasıl if ... else ... senaryoyu yapmalıyım
I this Q-A çalıştı, ama benim için çalışmıyor. PlsHlp.