Welcome Guest, Not a member yet? Register   Sign In
DB error after CI 1.6.1 upgrade
#1

[eluser]Lockzi[/eluser]
Hello,

after upgrading to CodeIgniter 1.6.1, I keep on getting this error message

Quote:Fatal error: Call to a member function order_by() on a non-object in C:\wamp\www\system\application\models\ss_model.php on line 32

Here's my model code (little stripped)

Code:
class Ss_model extends Model
{
    
    function Ss_model()
    {
        // Overloading with constructor
        parent::Model();
    }

    function retriveRecent($offset, $limit = 30)
    {
        
        $this->db->order_by("date", "desc");  
        
        if (is_numeric($offset))
            $this->db->offset($offset);
        if (is_numeric($limit))
            $this->db->limit($limit);
        
        if (!is_numeric($limit) && !is_numeric($offset))
        {
            $count = $this->db->get('news');
            return $count->result_array();
        }
        else
        {
            return $this->db->get('news');
        }
    }
}


Line 32 is this one
Code:
$this->db->order_by("date", "desc");


I have activated activerecord in the database.php file.

Cheers, Lockzi
#2

[eluser]Lockzi[/eluser]
Fixed.


Apparently you have to load the database library on your own now. Or maybe I've always have had to, but overwrote my autoload.php file.
#3

[eluser]Phil Sturgeon[/eluser]
1.6.1? When did that come out?

Anyway, yea you have to autoload the database class if you want to use it. Be careful on upgrades not to overwrite your config files. Dont copy that folder over and check the upgrade guide for what changes should be made there.
#4

[eluser]Lockzi[/eluser]
[quote author="thepyromaniac" date="1203096513"]1.6.1? When did that come out?

Anyway, yea you have to autoload the database class if you want to use it. Be careful on upgrades not to overwrite your config files. Dont copy that folder over and check the upgrade guide for what changes should be made there.[/quote]

Version 1.6.1

Release Date: February 12, 2008


Yes... Silly me... Smile
#5

[eluser]xwero[/eluser]
[quote author="thepyromaniac" date="1203096513"]1.6.1? When did that come out?[/quote]
3 days ago Smile
#6

[eluser]Lone[/eluser]
I so missed the release as well!
#7

[eluser]Derek Allard[/eluser]
Not much fanfare - it was mostly bug fixes, but there were some signficant additions, and the update is easy, so I'd recommend you go for it Wink If you use RSS, you can also just follow the CI news feed.




Theme © iAndrew 2016 - Forum software by © MyBB