Welcome Guest, Not a member yet? Register   Sign In
cannot call a function from the model folder
#1

[eluser]Unknown[/eluser]
forgive for being a complete noob, but I've been tackling this problem for quite a long time now.. see the code below.

system\application\models\hello.php
Code:
<?php

class Hello extends Model {

    function Hello(){
        parent::Model();
    }
    
    function index(){
       echo 'testing.....';
    }    
    
}

?>

system\application\controllers\caller.php
Code:
<?php
    class Caller extends Controller {

        function Caller(){
            parent::Controller();
        }

        function index(){
            $this->load->model('hello','index');
        }
    
    }
?>

when I run the program, it doesn't echo anything.. can you tell me whats wrong with the code? please help. it doesn't display any errors, just blank page.
thanks!
#2

[eluser]Yash[/eluser]
Code:
$this->load->model('Model_name');

$this->Model_name->function();

Read [url="http://ellislab.com/codeigniter/user-guide/general/models.html#loading"]USER GUIDE[/url]




Theme © iAndrew 2016 - Forum software by © MyBB