Welcome Guest, Not a member yet? Register   Sign In
Undefined property: CI_DB_mysqli_driver::$ar_orderby?
#1

I have a CodeIgniter (version 3)
Message: Undefined property: CI_DB_mysqli_driver::$ar_orderby

Filename: core/MY_Model.php

Line Number: 38

Backtrace:

File: /var/www/html/public/application/core/MY_Model.php
Line: 38
Function: _error_handler

Line Number: 38 and here you are

if (!count($this->db->ar_orderby)) {
$this->db->order_by($this->_order_by);
}
return $this->db->get($this->_table_name)->$method();
Reply
#2

(This post was last modified: 05-29-2015, 12:34 PM by CroNiX.)

Because it's not "active record" ie "ar_orderby". It's "query builder" in CI3.

https://github.com/bcit-ci/CodeIgniter/b...r.php#L143
Reply
#3

replace "ar_orderby" with "qb_orderby" in your MY_Model.php
Reply
#4

(05-29-2015, 11:06 PM)ngangchill Wrote: replace "ar_orderby" with "qb_orderby" in your MY_Model.php

I did it and I got a Message: Cannot access protected property CI_DB_mysqli_driver::$qb_orderby
Reply
#5

(05-29-2015, 12:33 PM)CroNiX Wrote: Because it's not "active record" ie "ar_orderby". It's "query builder" in CI3.

https://github.com/bcit-ci/CodeIgniter/b...r.php#L143

But I didn't understant  what i gonna do in this case
Reply
#6

More than likely, you'll have to rewrite your code to handle this on its own. The ar_orderby property was undocumented, and not meant to be used in your application code. You usually have three options for something like this:
1. Set a property within your model when you add an order by clause (and reset that property when you execute a get/insert/update request).
2. Use the get_compiled_select() method to get the generated SQL and check for the order by clause there.
3. Write your code in a way that makes tracking the addition of an order by clause unnecessary.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB