![]() |
Model query function not working with bound parameters - 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: Model query function not working with bound parameters (/showthread.php?tid=51639) |
Model query function not working with bound parameters - El Forum - 05-11-2012 [eluser]zulubanslee[/eluser] This function works if I hard code the values at the bottom of the query. I can confirm that the values are being passed via the parameters. But when I put in the question marks, it stops working. Am I making some foolish error? Code: function get_this_vehicle_info($ad_id, $user_id) Model query function not working with bound parameters - El Forum - 05-11-2012 [eluser]zulubanslee[/eluser] Incidentally, the query returns zero rows, not an error. Model query function not working with bound parameters - El Forum - 05-11-2012 [eluser]CroNiX[/eluser] See what it outputs. Code: echo $this->db->last_query(); Model query function not working with bound parameters - El Forum - 05-11-2012 [eluser]CroNiX[/eluser] Shouldn't it be Code: $query = $this->db->query($sql, array($ad_id, $user_id)); Model query function not working with bound parameters - El Forum - 05-11-2012 [eluser]zulubanslee[/eluser] Indeed that worked. I knew it was a stupid mistake. |