CodeIgniter Forums
[New with CI] I can't fetch any data from database - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: [New with CI] I can't fetch any data from database (/showthread.php?tid=60479)



[New with CI] I can't fetch any data from database - El Forum - 04-06-2014

[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


[New with CI] I can't fetch any data from database - El Forum - 04-06-2014

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