youpiyoupla Posted August 3, 2013 Share Posted August 3, 2013 (edited) Hi, I have a pyrocms installtion. I did a search form wich was working with the v2.1 but since I upgraded to pyrocms 2.2 I have an error in my search form. Error Number: 1054Unknown column 'project_name` LIKE '%project%'' in 'where clause'SELECT * FROM `default_projects` WHERE `project_name`` LIKE '%project%'` Here is my controller $project_name="'%".$_POST['project_name']."%'"; and my model : $test = "`project_name` LIKE $name ";$this->db->where($test);return $query = $this->db->get()->result_array(); I just paste the simplest query because my function is quite big. So this was working with pyrocms 2.1 but not anymore. Regards PS : I also tried$test = "project_name` LIKE $name "; but same result Edited August 3, 2013 by youpiyoupla Quote Link to comment https://forums.phpfreaks.com/topic/280796-query-help-error-number-1054/ Share on other sites More sharing options...
Barand Posted August 3, 2013 Share Posted August 3, 2013 (edited) You have 2 backticks after project_name and another at end of query SELECT * FROM `default_projects` WHERE `project_name`` LIKE '%project%'` Edited August 3, 2013 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/280796-query-help-error-number-1054/#findComment-1443336 Share on other sites More sharing options...
youpiyoupla Posted August 3, 2013 Author Share Posted August 3, 2013 THX, but how can I achieve this in php ? Because it automaticaly put backtick when I do a $this->db->where Quote Link to comment https://forums.phpfreaks.com/topic/280796-query-help-error-number-1054/#findComment-1443351 Share on other sites More sharing options...
Barand Posted August 3, 2013 Share Posted August 3, 2013 I have no idea what class you you are using when you mention $this->db->where, but I would find another one with reliable code. Quote Link to comment https://forums.phpfreaks.com/topic/280796-query-help-error-number-1054/#findComment-1443376 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.