Active Record: WHERE(.. OR ..) AND .. |
[eluser]wowdezign[/eluser]
This kind of stuff is exactly why I am starting to use more and more query binding. Your query above is almost already written to bind: Code: $sql="SELECT * FROM table WHERE id = ? AND (status = ? OR ip = ?)"; If you aren't passing in variables, I've had success with: Code: $sql="SELECT * FROM table WHERE id = 3 AND (status = 'somstatus' OR ip = 'x.x.x.x')"; I used to love active record. But, when I have a complex query, it's too hard for me to convert it. Since binding does the same thing, I just use it. :-) It's mentioned at the very bottom of this page in the manual: http://ellislab.com/codeigniter/user-gui...eries.html |
Messages In This Thread |
Active Record: WHERE(.. OR ..) AND .. - by El Forum - 11-10-2009, 12:03 PM
Active Record: WHERE(.. OR ..) AND .. - by El Forum - 11-10-2009, 03:14 PM
Active Record: WHERE(.. OR ..) AND .. - by El Forum - 11-10-2009, 03:39 PM
Active Record: WHERE(.. OR ..) AND .. - by El Forum - 11-10-2009, 03:39 PM
Active Record: WHERE(.. OR ..) AND .. - by El Forum - 11-10-2009, 03:45 PM
|