Welcome Guest, Not a member yet? Register   Sign In
Query works in phpMyAdmin but not with CI Active Record in php
#1

[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();
#2

[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...




Theme © iAndrew 2016 - Forum software by © MyBB