php - How do I do this query with ActiveRecord Class from Code Igniter? -


I need to increase the number of comments on the entries table, for this would be SQL:

  Enter entries to entries Comments = Comments + 1 WHERE entry_id = 123;  

And I was wondering how to use the active code class form code ignition.

Your question is too much a duplicate of the third parameter of the set on FALSE Setting prevents you from avoiding data.

  $ this-> Db- & gt; Set ('Comments', 'Comments + 1', Wrong) $ - & gt; DB- & gt; Where ('entry_id', 123); $ This- & gt; Db- & gt; Updates ('entries');  

You do not have to stop anything executing SQL if you have an active record slightly peak.

  $ sql = 'UPDATE entries SET comments = comments +1 WHERE entry_id =? '; $ This- & gt; Db- & gt; Query ($ sql, array (123));  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -