I have a search field in my form which searches data from a database and displays it on a result page. When I try to search data I get this error.
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined index: names
Filename: views/searchresults.php
Line Number: 43
I know the data I am passing to the view does not contain the 'names' field which means the query I am using is not retrieving this value from the database. Here is my database query
Code:
//this function gets all the contacts given a cerain parameter
public function search_data($param) {
//query
$this->db->select('users,numbers');
$this->db->from('phones');
$this->db->like('phones.users',$param);
$this->db->or_like('phones.numbers', $param);
$this->db->or_like('offices.names', $param);
$this->db->join('offices', 'phones.offices = offices.id', 'left');
//return the result
$query = $this->db->get();
return $query->result_array();
}
The 'names' field is in my office table, thus it must be my join function which is not working. Any help will be greatly appreciated