Bel gewoon where()
in de if-instructie, voordat u get()
. aanroept .
$this->db->select('name');
if(isset($name))
{
//add where clause here, to select specific name
$this->db->where('name', $name);
}
$query = $this->db->get('user');
$result_array = $query->result_array();
Documentatie:
https://www.codeigniter.com/user-guide/database/active_record .html