[eluser]stuffradio[/eluser]
You need to look at Models.
In the Model folder, I always create a file and name the filename the same as the name of the table I'm using.
So if I have a table called Users, and I have ID, Username, and Password here is what it would look like.
Path: /system/application/models/users.php
Code:
<?php
class Users extends Model
{
var $ID; // I don't usually put an ID var
var $Username; // Var that handles username
var $Password; // Var for password
function Users()
{
parent::Model();
}
function getUsers()
{
$query = $this->db->get('Users');
return $query->result();
}
}
In my controller file:
path: /system/application/controllers/controllerfile.php
Code:
<?php
class Controllerfile extends Controller
{
function Controllerfile()
{
parent::Controller();
$this->load->model('users');
}
function index()
{
$data['users'] = $this->users->getUsers();
$this->load->view('myview', $data);
}
}
View file:
path: /system/application/views/myview.php
Code:
<?php foreach ($users as $user): ?>
<h1><?=$user->Username;?></h1>
<?php endforeach; ?>
This is something quick and dirty, enjoy!