![]() |
Search Error keeps appearing - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Search Error keeps appearing (/showthread.php?tid=14468) |
Search Error keeps appearing - El Forum - 01-03-2009 [eluser]clintonbeattie[/eluser] Hi, I am working through the Wrox Codeigniter book and keep getting this error when searching(I'm on page 126)... A PHP Error was encountered Severity: Notice Message: Undefined variable: results Filename: views/search.php Line Number: 5 This is my search.php file contents... Code: <div id='pleft'> All others files are as written in the book and have been double checked with the downloaded files. Can anyone shed any light on this? Thanks, C PS Here are my model view code and controller code... Code: function search($term){ Code: function search() { Search Error keeps appearing - El Forum - 01-03-2009 [eluser]Armchair Samurai[/eluser] As per the error message, you're not passing any variable called $results to the view. Try changing Code: $search['results'] = $this->MProducts->search($this->input->post('term')); to Code: $data['results'] = $this->MProducts->search($this->input->post('term')); in your controller. If you're copying from a book, looks like an error on the author's part. Search Error keeps appearing - El Forum - 01-04-2009 [eluser]clintonbeattie[/eluser] Thanks for that! Fixed the problem. Will know for future. |