Question

Since I upgraded to pyrocms 2.2 I have an error in my search form.

Error Number: 1054

Unknown 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

Was it helpful?

Solution

How about using:

$this->db->like('project_name',$name); 

Codeigniter DB active record docs

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top