![]() |
Or_where Help - 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: Or_where Help (/showthread.php?tid=32368) |
Or_where Help - El Forum - 07-21-2010 [eluser]derekmichaeljohnson[/eluser] I'm trying to form a query like this: Code: SELECT * Or_where Help - El Forum - 07-21-2010 [eluser]Jbeasley6651[/eluser] Code: $where = "city='dallas' AND type='a' OR role='lead'"; Or_where Help - El Forum - 07-21-2010 [eluser]KingSkippus[/eluser] Just a short best practice note. Use backticks in MySQL for database, table, or column names, but use single quotation marks for string literals. Your original query should have been: Code: SELECT * Or_where Help - El Forum - 07-21-2010 [eluser]Jbeasley6651[/eluser] King, Is there a difference in performance, and if so is it noticeable? Or_where Help - El Forum - 07-21-2010 [eluser]KingSkippus[/eluser] No, at least not that I know of, and if so, it's probably minuscule. It's for portability. Not just for your code, though that's a definite bonus in case you ever decide you want your database to live on another DBMS, but for your skills as well. Using well-established standards will allow you to easily shift between MySQL, Oracle, SQL Server, PostgreSQL, Sybase, or whatever. |