Welcome Guest, Not a member yet? Register   Sign In
How to convert this update QUERY to ActiveRecord
#5

[eluser]MpaK69[/eluser]
yeah, ok, I understand I cant do this with AC pattern

I did it with query

Code:
if($neword < $oldord){
            // UP
            $this->db->query('UPDATE '.$this->dbprefix.'menu SET ord_id=ord_id+1 WHERE ord_id >= ? AND ord_id <= ? AND pid = ?', array($neword, $oldord, $pid) );
            $this->db->set('ord_id', $neword);
            $this->db->where('uid', $lastid);
            $this->db->update('menu');
        }elseif($neword > $oldord){
            // DOWN
            $this->db->query('UPDATE '.$this->dbprefix.'menu SET ord_id=ord_id-1 WHERE ord_id <= ? AND ord_id >= ? AND pid = ?', array($neword, $oldord, $pid) );
            $this->db->set('ord_id', $neword);
            $this->db->where('uid', $lastid);
            $this->db->update('menu');
        }


Messages In This Thread
How to convert this update QUERY to ActiveRecord - by El Forum - 07-03-2007, 05:44 AM
How to convert this update QUERY to ActiveRecord - by El Forum - 07-03-2007, 11:24 PM
How to convert this update QUERY to ActiveRecord - by El Forum - 07-03-2007, 11:26 PM
How to convert this update QUERY to ActiveRecord - by El Forum - 07-03-2007, 11:32 PM
How to convert this update QUERY to ActiveRecord - by El Forum - 07-04-2007, 12:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB