How can I get active records NOT to add single quotes to int values? |
[eluser]behnampmdg3[/eluser]
Code: $this->db->select('products_table.id, code, class, category, status, price, production_date, products_status.title AS STATUS'); Thanks Code: SELECT `products_table`.`id`,
[eluser]boltsabre[/eluser]
Try sending it with the third WHERE paramter FALSE to disable automatic escaping by active records. Search the page below for: $this->db->where(); to see the documentation http://ellislab.com/codeigniter/user-gui...ecord.html Also see the second answer here, using get_where http://stackoverflow.com/questions/14548...ause-value Something like: Code: $this->db->where('class', $data, FALSE); Let us know how it goes, and mark this post as answered if it works. Thanks!
[eluser]behnampmdg3[/eluser]
Thanks I realise this but as you can see I am sending an array of mixed data and I was hoping that CI can differentiate between int and other type. $this->db->where($data); Does it make sense?
[eluser]phpLearner[/eluser]
Where did you write the array data? and write the where query directly instead of passing array you can also try writing query directly $sql="SELECT * FROM table WHERE id > ? AND class=? "; $query=$this->db->query($sql,array($id,$class)); check if this works
[eluser]boltsabre[/eluser]
Well can't you just split your $data array then, something like: Code: $this->db->where( $data[0], $data[1], FALSE); // numeric array |
Welcome Guest, Not a member yet? Register Sign In |