Welcome Guest, Not a member yet? Register   Sign In
A mysterious problem
#1

[eluser]juan1904[/eluser]
Hi,

I've got a mysterious problem which is eating me. I'm so frustrated right now.

Here we go:
Code:
class Admin_model extends Model {

    function __construct()
    {
        parent::Model();
    }

    function generate_schedule()
    {
        // More code here..
        $play_dates = __get_play_dates();
        // More code here..
    }

__get_play_dates is defined in Admin_model and returns an array.

The error message I get:

Fatal error: Call to undefined function __get_play_dates() in C:\wamp\www\myproject\system\application\models\admin_model.php on line 181
#2

[eluser]jedd[/eluser]
Rather than this:
Code:
$play_dates = __get_play_dates();

Try this:
Code:
$play_dates = $this->__get_play_dates();

I don't expect the double underscores are causing trouble, but I'd be wary about using them (mostly for readability reasons).
#3

[eluser]juan1904[/eluser]
Thank you jedd, that worked out for me. I'm still curious why I didn't need $this-> in another model of mine, when I needed it in Admin_model.
#4

[eluser]Thorpe Obazee[/eluser]
You should probably look into that model. Anyway, you'll probably want to put same functions in a MY_Model.




Theme © iAndrew 2016 - Forum software by © MyBB