This question already has an answer here:
- Codeigniter: Passing data from controller to view 9 answers
I am having issues figuring out why my $data variable isn't passing to my search_view, I pass sql data from model as shown below:
$this->db->like('LOWER(title)', strtolower($query)); $q = $this->db->get('questions'); $data = $q->row_array(); $q->free_result(); $this->load->view('search_view', $data);
and than try to echp out a row in my search_view for example
echo $data['title']; however get an error saying that variable data is undefined.
I tested it and echoed same thing out without loading a view, just an echo from model works. So I am sure it is getting correct data from database.
and in view file