Welcome Guest, Not a member yet? Register   Sign In
Why isn't there an update_where() method?
#1

[eluser]BDKR[/eluser]
It seems rather intuitive if you ask me.

I decided to just write it and the method itself just be a wrapper for where() and update(). Thankfully, I got smart and ran to Google. As it turns out, one of our Russian comrades did exactly what I was thinking.

Code:
/** Обновляем записи */
   function update_where ($table, $row, $value, $data_array)
   {
      $this->db->where($row, $value);
      $this->db->update($table, $data_array);
   }

So why couldn't something like this make it's way into the core?
#2

[eluser]sophistry[/eluser]
looks like it's already in there.

http://ellislab.com/codeigniter/user-gui...tml#update

gosh codeigniter devs are fast.
#3

[eluser]BDKR[/eluser]
Hmmm..... I didn't see it.
#4

[eluser]mitchwilson[/eluser]
Yeh, I thought the same thing. An update_where method would act like get_where.

I just use chaining:
Code:
$this->db->where($row, $value)->update($table, $data_array);




Theme © iAndrew 2016 - Forum software by © MyBB