Welcome Guest, Not a member yet? Register   Sign In
View2
#1

[eluser]davy_yg[/eluser]

kendaraan.php

Code:
<?php
class Kendaraan extends CI_Controller
{

function Kendaraan()
{
  parent::CI_Controller();
}

function index()
{
  echo 'Class Kendaraan';
}

function roda_empat()
{
  echo 'Ini adalah function roda empat';
}

function roda_dua()
{
  echo 'Ini adalah function roda dua';
}
}
?>

I try to call the function using this url: http://localhost/CodeIgniter_214/index.p...n/roda_dua

Fatal error: Call to undefined method CI_Controller::Controller() in C:\xampp\htdocs\CodeIgniter_214\application\controllers\kendaraan.php on line 8

Why is it?
#2

[eluser]noideawhattotypehere[/eluser]
change
Code:
parent::CI_Controller();
to
Code:
parent::__construct();

and dont close php tag.
#3

[eluser]davy_yg[/eluser]
It works. Why is it?

I am following a book tutorial which uses Codeigniter 1.7

Is it because I am using CodeIgniter 2.1.4?
#4

[eluser]noideawhattotypehere[/eluser]
Yes, there will be some diffrences because of changes in v.2+.

PS: Keep using 2.1.4, dont use old software.




Theme © iAndrew 2016 - Forum software by © MyBB