• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.