Welcome Guest, Not a member yet? Register   Sign In
Model issue...
#1

[eluser]echoDreamz[/eluser]
Code:
A PHP Error was encountered
Severity: Notice

Message: Undefined property: Welcome::$quotes

Filename: controllers/Welcome.php

Line Number: 13

Code:
$this->load->model('shared/quotes', 'quotes');
        $this->quotes->get_random_quote();

Code:
class Quotes extends Model
{
    /**
     * Quotes_model class constructor
     *
     * @return Quotes_model
     */
    public function Quotes()
    {
        parent::Model();
    }
    
    /**
     * Returns a random quote array from the database
     * This will require the calling method to assemble the array
     *
     * @return Array
     */
    public function get_random_quote()
    {
        /* Query for a random quote from the jc_quotes table */
        $this->db->select('quote', 'author')->from('quotes')->order_by('RAND()');
        $query = $this->db->get();
        
        return $query->result_array();
    }
}

/* End quotes.php */

Seems I cannot get this to work no matter what I do. Can any help?
#2

[eluser]echoDreamz[/eluser]
Got it!

Thanks for the views!




Theme © iAndrew 2016 - Forum software by © MyBB