Welcome Guest, Not a member yet? Register   Sign In
IF statement in an MySQL query
#10

[eluser]CroNiX[/eluser]
Jonez, there is a difference between escaping identifiers with backticks and escaping variables using blah_real_escape_string(), which AR does automatically when using their built in methods. The 2nd parameter to select only disables the table/field identifier tickmarks, which CI can't correctly add in to more complex statements due to it's limitations. Like, there is no db:Confusedelect_if() statement, so it doesn't know how to handle it manually. So in those cases, you'd want to set the 2nd parameter of select to FALSE so it won't add them in at all. You can add them in manually if you want.

Notice the inappropriately placed tickmarks within the IF clause in the error:
Code:
SELECT DISTINCT `item`.*, IF( item.Is_group = '1', `.`65`, `.`75` ) AS margin,


Messages In This Thread
IF statement in an MySQL query - by El Forum - 11-05-2009, 02:08 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 02:31 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 05:01 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 05:06 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 05:09 PM
IF statement in an MySQL query - by El Forum - 11-05-2009, 05:17 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 02:40 AM
IF statement in an MySQL query - by El Forum - 01-21-2014, 10:41 AM
IF statement in an MySQL query - by El Forum - 01-21-2014, 12:44 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 12:51 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 01:00 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 01:08 PM
IF statement in an MySQL query - by El Forum - 01-21-2014, 01:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB