Codeigniter setting multiple where conditions, how to unset one
I've got a script that is a notify_url from paypal that is supposed to update multiple tables in my database using the following code:
//update first table
$this->db->where('someid', $somid); $this->db开发者_运维问答->update('table', $data); ///update second table $this->db->where('somesecondid', $somesecondid) $this->db->update('anothertable', $data2); Then I get the following error: Unknown column 'somesecondid' in 'where clause'UPDATE anothertable
SET avail
= 0 WHERE someid
= '13' AND somesecondid
= '199'
You might want to look into Active Record Caching in the user_guide...
http://codeigniter.com/user_guide/database/active_record.html#caching
Maybe you have '$this->db->start_cache()' somewhere earlier in your code.
Currently, I'm unable to replicate your error. I'm successfully running two update statements as you have them above.
As an alternative, you can pass the WHERE
clause information directly to $this->db->update()
using an array (per the CodeIgniter Active Record documentation) like this:
$this->db->update('table', $data, array('someid' => $someid));
$this->db->update('anothertable', $data2, array('somesecondid' => $somesecondid));
精彩评论