My CI version is CI2.3. I'm running this php code in my local host. I followed all the steps given there but I'm getting this error don't know why? and I changed Controller to CI_Controller. Hello world Program
worked finely. This link code is not working. please need help!
Asked
Active
Viewed 1.8k times
5

Suheal Pasha
- 49
- 1
- 2
- 7
-
2you can follow 1st what thay are given. May be you are new for CI. and study the rules http://ellislab.com/codeigniter/user-guide/ – KarSho Jul 03 '13 at 04:31
-
What 2.3 version? latest is 2.1.3 only. @Damien what man? – KarSho Jul 03 '13 at 05:16
-
@KarSho I was referring to the CODE linked by OP, not to the MANUAL you linked. – Damien Pirsy Jul 03 '13 at 07:06
4 Answers
4
you should extend model like this in codeIgniter
class Modelname extends CI_Model
{
function __construct()
{
parent::__construct();
}
}

Rajeev Ranjan
- 4,152
- 3
- 28
- 41
1
Well actually the study guide is of old version of CI, where you used to extend your models from Model class as show in the guide. But now it has been changed. Now you have to extend it from CI_Model, same goes for Controller.
For controllers
class Employee_controller extends CI_Controller
{
//load the constructor
function __construct()
{
//inherit the parent constructor
parent::__construct();
}
}
and for models:
class Employee_model extends CI_Model
{
//load the constructor
function __construct()
{
//inherit the parent constructor
parent::__construct();
}
}

Just Mohit
- 141
- 1
- 13

Mohammad Ismail Khan
- 641
- 3
- 7
0
You must create a model
in the model folder like my_model.php
And create the class
like
class My_model extends CI_Model
{
function __construct()
{
parent::__construct();
}
}
Remember the class
and the file
should be same.
Docs http://ellislab.com/codeigniter/user-guide/general/models.html

Rohan Kumar
- 40,431
- 11
- 76
- 106
0
Use like this
<?php
class Employee_model extends CI_Model
{
//load the constructor
function __construct()
{
//inherit the parent constructor
parent::__construct();
}
}

Sundar
- 4,580
- 6
- 35
- 61