Welcome Guest, Not a member yet? Register   Sign In
Call to a member function get() on a non-object
#7

[eluser]CappY[/eluser]
Can any1 help me with similar problem ? Currentry Im trying to rewrite my site on CodeIgniter but I dont really know OOP and im trying to learn it. Smile

Fatal error: Call to a member function row() on a non-object in /var/www/test/htdocs/application/views/stats/artist_view.php on line 3

Controller:
Code:
function artist()
    {
        $artist = $this->uri->segment(3);
        $from = $this->uri->segment(4);
        if($from == NULL) $from = 0;
        $to = $from + 30;
        $this->load->model('stats_model','',true);
        $data['query'] = $this->stats_model->getArtist($artist, $from, $to);
        $data['title'] = 'Artist - '.$artist;
        $this->load->vars($data);
        // Loading View !
        $data['view'] = 'stats/artist_view';
        $this->load->view('template', $data);
    }

Model:
Code:
function getArtist($artist, $from, $to)
    {
        $query = $this->db->query('SELECT `artist`,`title`,COUNT(title) AS `played` FROM `songs` WHERE `artist`=".$artist." GROUP BY `title` ORDER BY COUNT(title) DESC LIMIT '.$from.' , '.$to);
        return $query->result();
    }

view:
Code:
$row = $query->row();
$last_fm_artist = urlencode($row->artist);
....


Messages In This Thread
Call to a member function get() on a non-object - by El Forum - 10-08-2010, 02:02 AM
Call to a member function get() on a non-object - by El Forum - 10-08-2010, 02:24 AM
Call to a member function get() on a non-object - by El Forum - 10-08-2010, 03:25 AM
Call to a member function get() on a non-object - by El Forum - 10-08-2010, 04:55 AM
Call to a member function get() on a non-object - by El Forum - 10-08-2010, 11:25 AM
Call to a member function get() on a non-object - by El Forum - 10-08-2010, 12:36 PM
Call to a member function get() on a non-object - by El Forum - 02-05-2011, 03:01 AM
Call to a member function get() on a non-object - by El Forum - 02-05-2011, 03:55 AM
Call to a member function get() on a non-object - by El Forum - 02-05-2011, 04:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB