Welcome Guest, Not a member yet? Register   Sign In
[New with CI] I can't fetch any data from database
#1

[eluser]BobyKurniawan[/eluser]
Hey, i'm new with CI.

I want to showing a record from my table. Here are my script so far :

My model. Biodat.php

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Biodat extends CI_Model
{
  function getdata()
  {
  $ambil = $this->db->get('biodata_mhs');
  if($ambil->num_rows() > 0)
   {
   foreach($ambil->result() as $baris)
    {
     $hasil[] = $baris;
    }
    return $hasil;
   }
  }
}

My controllers . Bioshow.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Bioshow extends CI_Controller{
function index(){
  $this->load->model('biodat');
  $data['biodata_mhs'] = $this->biodat->getdata();
  $this->load->view('vbio',$data);
}
}

Here is the error message . "Unable to locate the model you have specified: tampil".

Sorry for my bad english Sad
#2

[eluser]BobyKurniawan[/eluser]
I've solved the error. I put 'tampil' in autoload, then i change it to 'biodat' , everything is solved now.




Theme © iAndrew 2016 - Forum software by © MyBB