![]() |
How can I get active records NOT to add single quotes to int values? - 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: How can I get active records NOT to add single quotes to int values? (/showthread.php?tid=58148) |
How can I get active records NOT to add single quotes to int values? - El Forum - 05-20-2013 [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`, How can I get active records NOT to add single quotes to int values? - El Forum - 05-21-2013 [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-guide/database/active_record.html Also see the second answer here, using get_where http://stackoverflow.com/questions/14548644/active-record-in-codeigniter-automatically-adds-quotes-around-where-clause-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! How can I get active records NOT to add single quotes to int values? - El Forum - 05-21-2013 [eluser]behnampmdg3[/eluser] Thanks I realise this ![]() $this->db->where($data); Does it make sense? How can I get active records NOT to add single quotes to int values? - El Forum - 05-21-2013 [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 How can I get active records NOT to add single quotes to int values? - El Forum - 05-22-2013 [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 |