Welcome Guest, Not a member yet? Register   Sign In
How to add a counter to a MySQL Table?
#7

[eluser]Unknown[/eluser]
i had the same problem, and i still wanted to pass an array to the update function,

using:
Code:
$this->db->set($data, false);

didn't worked.

so i solved it with this code:

Code:
function update($id, $data)
{
   $data = array(
      'click_count' => 'click_count + 1'
   );

   foreach($data as $k => $v)
   {
      $this->db->set($k, $v, false);
   }
   $this->db->where('id', $some_id);
   $this->db->update('ads');
}

hope that helped.


Messages In This Thread
How to add a counter to a MySQL Table? - by El Forum - 07-30-2009, 11:17 PM
How to add a counter to a MySQL Table? - by El Forum - 07-31-2009, 12:38 AM
How to add a counter to a MySQL Table? - by El Forum - 07-31-2009, 02:22 AM
How to add a counter to a MySQL Table? - by El Forum - 07-31-2009, 03:28 AM
How to add a counter to a MySQL Table? - by El Forum - 07-31-2009, 03:58 AM
How to add a counter to a MySQL Table? - by El Forum - 07-31-2009, 09:48 PM
How to add a counter to a MySQL Table? - by El Forum - 09-06-2009, 08:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB