[solved] SET and UPDATE |
[eluser]SPeed_FANat1c[/eluser]
My code: Code: function addClick() I see that it generates such query Code: UPDATE `jos_reklama_banners` SET `clicks` = 'clicks+1' WHERE `filename` = 'file26.jpg' But this query does not increase the value of clicks. The query that works should be Code: UPDATE `jos_reklama_banners` SET clicks = clicks+1 WHERE `filename` = 'file26.jpg' you can see that the word clicks is without ' signs. That causes the problem. How to make what I want using active record? Or do I have to use $this->db->query('my statement') ?
[eluser]danmontgomery[/eluser]
This specific case is covered in the user guide. http://ellislab.com/codeigniter/user-gui...tml#update Quote:set() will also accept an optional third parameter ($escape), that will prevent data from being escaped if set to FALSE. To illustrate the difference, here is set() used both with and without the escape parameter.
[eluser]SPeed_FANat1c[/eluser]
oh, thanks, I saw it but didn't pay attention, just skipped because I thought why I would ever need to set escape to FALSE ![]() |
Welcome Guest, Not a member yet? Register Sign In |