Welcome Guest, Not a member yet? Register   Sign In
controllers and model
#1

I'm a beginner with codeigniter, I'm trying to insert the records into the database, but the in the editor phpstorm I'm using showing the model as an unidentified. someone please help me with this.

Code:
public function index()
   {
       $this->load->library('form_validation');
       $data['title']= 'Workload';
       $this->load->model('Workload_Model');
       $data['workload']  = $this->Workload_Model->get_workload();
       $this->load->view('templates/header');
       $this->load->view('administrator/Workload', $data);
       $this->load->view('templates/footer');
   }
$data['workload']  = $this->Workload_Model->get_workload();
 workload_model in this line is showing not found.
Reply
#2

@nikhil9989,

What is the model file name? Workload_Model or Worklord_model? Also, when you declared the class what name did you use? Workload_Model or Worklord_model? It may be the way you named your model class.
Reply
#3

Might be a file and class naming problem. I suspect it is the uppercase M in Model. The file name should be Workload_model.php  (with that exact character case usage) and the class code should be as follows

PHP Code:
class Workload_model extends CI_Model 

Change the controller to look like this

PHP Code:
$this->load->model('workload_model');
$data['workload' $this->workload_model->get_workload(); 
Reply
#4

not an error it should work just fine phpStorm doe's not see all of the CodeIgniter
classes in the frame work, there are work around's in the forums.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB