coolest
coolest

Reputation: 795

A PHP Error was encountered while seeting up CodeIgniter

I want to set up my first project in CodeIgniter. I'm following the steps as shown in this page :http://code.tutsplus.com/tutorials/everything-you-need-to-get-started-with-codeigniter--net-2634 When trying to follow the 8th step I have an error. This is my code:

<?php
    class diploma extends Controller{
        function index()
        {

        
            $this->load->model('diploma_model');
 
            $data['result'] = $this->diploma_model->
           <span class="sql">getData </span>();
          
            $data['page_title'] = "CI Hello World App!";
 
            $this->load->view('diploma_view',$data);
        }
    }
?>

This is my error: enter image description here

I'm new at CodeIgniter. Can someone explian me why this error occurs? Thanks!

After editing this piece of code

 $data['result'] = $this->diploma_model->
               <span class="sql">getData </span>();
like this:

 $data['result'] = $this->diploma_model->
               getData ();
This is my error now: enter image description here

Upvotes: 1

Views: 69

Answers (1)

Abdulla Nilam
Abdulla Nilam

Reputation: 38672

Errors

  1. missing the Model method to call in Controller
  2. Wrong Model callback


$data['result'] = $this->diploma_model-> # Missing here

Example

$data['result'] = $this->diploma_model->getData();

FYI

This is wrong

$data['result'] = $this->diploma_model->
           <span class="sql">getData </span>(); # span class cannot add to the model callback function 

this should be

$data['result'] = $this->diploma_model->getData();

EDIT

This should be

class diploma extends Controller{

Change to this

class Diploma extends CI_Controller {

Upvotes: 1

Related Questions