composing sql command - 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: composing sql command (/showthread.php?tid=53353) |
composing sql command - El Forum - 07-20-2012 [eluser]Unknown[/eluser] Hi guys, I need to write this sql in CI: Code: SELECT * FROM product WHERE as you see, I have data from search-form with 2 variables - producer_id and q (some searched value). If I use this code, I get sql command without brackets (and that´s wrong): Code: $this->db->where('producer_id', $search['producer_id']); Code: SELECT * FROM product WHERE do you have any suggestions how to do this? thank you composing sql command - El Forum - 07-20-2012 [eluser]rwestergren[/eluser] You could do this two ways: 1: A custom string, the active record way Code: $this->db->where('producer_id', $search['producer_id']); 2: Using your intended query manually Code: $results = $this->db->query(" composing sql command - El Forum - 07-22-2012 [eluser]Unknown[/eluser] thank you, |