Assignment Operator := breaks the query builder |
I am try to create this query using the query builder
Code: SELECT *, (@no:=@no+1) AS no FROM user WHERE user.deleted = 0 Code: SELECT *, (@no:=@no+1) AS no FROM `user` WHERE `user`.`deleted` = :user.deleted: This is the code I used to this
Code: $this->builder = $this->db->table('user');
Try adding the optional FALSE parameter to the select method documented here: https://codeigniter.com/user_guide/datab...cting-data.
PHP Code: $this->builder->select('*, (@no:=@no+1) AS no', FALSE); This prevents CodeIgniter from automatically escaping fields that may break your query. |
Welcome Guest, Not a member yet? Register Sign In |