CodeIgniter Forums
Query works in phpMyAdmin but not with CI Active Record in php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Query works in phpMyAdmin but not with CI Active Record in php (/showthread.php?tid=33963)



Query works in phpMyAdmin but not with CI Active Record in php - El Forum - 09-14-2010

[eluser]asciiCode[/eluser]
I have an Active Record statement that does an update. When I call it in php it does not work. However when I log_message the $this->db->last_query(); and then run the query in phpMyAdmin, it works.

Why would this be happening?

Should I not use Active Record for this query?

$this->db->where('ID1', $id1);
$this->db->where('ID2', $id2);
$this->db->set('MyBooleanValue', false);
$ret = $this->db->update('MyTable');

$num_rows = $this->db->affected_rows();


Query works in phpMyAdmin but not with CI Active Record in php - El Forum - 09-14-2010

[eluser]WanWizard[/eluser]
What is the definition of 'work' and 'not work'? Error messages? Unexpected behaviour?
What database engine are you using?

This should result in
Code:
UPDATE `MyTable` SET `MyBooleanValue` = 0 WHERE `ID1` = '$id1' AND `ID2` = '$id2'
which looks fine to me...