views:

241

answers:

2

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'


So codeigniter is combining those where clauses into a single query. Is there a way to unset the first one so it only has "UPDATE anothertable SET avail=0 WHERE somesecondid = 199" ? Thanks!

A: 

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));
Colin
A: 

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.

Nickro