[Active Records] Disabling the protection of identifiers |
[eluser]Clooner[/eluser]
The following statement gives me problems Code: $this->db->select('round(produces.price*produces.discount*'.vat().',2) as price'); This will generate mysql code which is invalid. Code: `round(produces`.`price*produces`.`discount*1`.`19`, `2)` I tried to use $this->db->protect_identifiers but this function doesn't allow you to disable the backticks. How can I disable the backticks generated for the 1.19 value?
[eluser]bretticus[/eluser]
From manual... Quote:$this->db->select() accepts an optional second parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks. This is useful if you need a compound select statement.
[eluser]Clooner[/eluser]
[quote author="bretticus" date="1251863324"]From manual...[/quote] Stupid me... I was too focused on the $this->db->protect_identifiers which made we not check more of the manual. Thanks bretticus. The worse thing is that in this post I give the ansmer myself. I need more sleep
[eluser]bretticus[/eluser]
[quote author="clooner" date="1251894048"] Stupid me... I was too focused on the $this->db->protect_identifiers which made we not check more of the manual. Thanks bretticus. The worse thing is that in this post I give the ansmer myself. I need more sleep[/quote] Hahaha. Happens to me all the time! Good thing CI has detailed docs (when you can scrutinize them better when not exhausted.) You're welcome. |
Welcome Guest, Not a member yet? Register Sign In |