• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Call to undefined method CI_DB_mysql_driver::row()

#1
[eluser]MikePearce[/eluser]
------- EDIT -----------
I am such an a$$ - I forgot:
Code:
$this->db->get();
after the AR call.

Sorry to waste your time!

------- EDIT ---------

Hi all,

Perhaps I am being a dumbass, but I'm getting this error:

Quote:Call to undefined method CI_DB_mysql_driver::row()

and this is the model:
Code:
class Portfolio extends Model {
    
        var $shop_id; // Contains the ID for the Whats in the Shop car.
    
        function Portfolio() {
            parent::Model();
            $this->load->database();
        }
        function getShop(){
            if (empty($this->shop_id)){
                $q = $this->db->select('p_id')->from('type_lkp')->where('t_id',3)->orderby('p_id', 'desc')->limit(1);
                $row = $q->row();
                $this->shop_id = $row->name;
            }
            return $this->shop_id;
        }
        function getShopCopy() {
            $q = $this->db->select('desc')->from('portfolio')->where('id', $this->getShop());
            $r = $q->row();
            return $r->desc;
        }
}

The error is on this line: $row = $q->row();

I can't see what the problem is - am I doing something very stupid?

Thanks in advance,

Mike

#2
[eluser]luisjose[/eluser]
Maybe is that way:

$row = $q->result()->row();

#3
[eluser]MikePearce[/eluser]
Hi Luisjose,

Thanks for the reply, what I actually did was prepared the SQL statement using ActiveRecord and then didn't actually *execute* the query to get the DB object.

Once you've got the db object, then you can extract the result.

I *was* being a dumba$$ afterall!

Mike


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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