CodeIgniter Forums
sql into active records query - 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: sql into active records query (/showthread.php?tid=33653)



sql into active records query - El Forum - 09-03-2010

[eluser]keevitaja[/eluser]
hello,

can i do this in active records query?

Code:
$sql  = "update " . $this->db->dbprefix('languages') . " set ";
    $sql .= "active = active * -1 where id= ?";
    
    return $this->db->query($sql, $language_id);



sql into active records query - El Forum - 09-03-2010

[eluser]davidbehler[/eluser]
Code:
$this->db->set('active', 'active * -1', FALSE);
$this->db->where('id', $language_id);
$this->db->update('languages');