Ring bara where()
i if-satsen innan du anropar get()
.
$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();
Dokumentation:
https://www.codeigniter.com/user-guide/database/active_record .html