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

[eluser]davy_yg[/eluser]
models/mberitainyong.php

Code:
<?php
class Mberitainyong extends CI_Model {

function ambildatabase() {
  $ambil=$this->db->get('beritainyong');
  if ($ambil->num_rows()>0) {
   foreach($ambil->result() as $row) {
    $data[]=$row;
   }
  return $data;
  }
}
}
?>

controllers/cberitainyong.php

Code:
<?php

class Ckabarinyong extends CI_Controller {
function index(){
  $this->load->model('mkabarinyong');
  $data['records']=$this->mkabarinyong->ambildatabase();
  $this->load->view('vkabarinyong', $data);
}
}

?>


views/vkabarinyong.php

Code:
<html>
<head>
  <title> :: Kabar Inyong - Kabare Wong Panginyongan :: </title>
</head>
<body>
  KABAR INYONG DITAMPILKAN DENGAN BAIK
  <pre>
   <p>&lt;?php echo print_r($records); ?&gt;</p>
  </pre>
&lt;/body&gt;
&lt;/html&gt;


http://localhost/CodeIgniter_214/index.p...inyong.php

404 Page Not Found

The page you requested was not found.

Why is it?
#2

[eluser]noideawhattotypehere[/eluser]
Try:
http://localhost/CodeIgniter_214/index.php/ckabarinyong

Its like: base_url/controller/method, if no method specified then it takes index() as default. You dont call views from url.
#3

[eluser]davy_yg[/eluser]

I try http://localhost/CodeIgniter_214/index.php/ckabarinyong

The same thing appears:

404 Page Not Found

The page you requested was not found.
#4

[eluser]noideawhattotypehere[/eluser]
controllers/cberitainyong.php
class Ckabarinyong
Why controllers filename != class name?




Theme © iAndrew 2016 - Forum software by © MyBB