[eluser]Unknown[/eluser]
hello..i am trying to use pagination class
this is the controller..
Code:
<?php
class Exam extends Controller{
function __construct()
{
parent::controller();
$this->load->helper('url');
$this->load->library('pagination');
}
function index()
{
}
function user()
{
$page_item ='2';
echo $this->uri->segment(4);
$this->load->library("pagination");
$this->load->model("exam_model");
$config['base_url'] ='http://localhost/demo/index.php/admin/exam/user/';
$config['total_rows'] = $this->exam_model->count_alluser();
$config['per_page']=$page_item;
$config['full_tag_open'] = '<div id="pt">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$items['data'] = $this->exam_model->get_user($page_item,$this->uri->segment(4));
$this->load->view("vdemo",$items);
}
}
?>
this is the model..
Code:
<?php
class Exam_model extends Model{
function __construct()
{
parent::Model();
$this->load->database();
}
function get_user($num,$off)
{
$this->db->limit($num,$off);
$query=$this->db->get('user');
return $query->result_array();
}
function count_alluser()
{
return $this->db->count_all("user");
}
}
?>
this is the view..
Code:
<table width="413" border="1">
<tr>
<td width="36">ID</td>
<td width="201">Username</td>
<td width="154">Password</td>
</tr>
<?php
$id=1;
foreach($data as $item)
{
echo "<tr>";
echo "<td>".$id."</td>";
echo "<td>".$item['username'].'</td>';
echo "<td>".$item['password']."</td>";
echo "</tr>";
$id++;
}
?>
</table>
<?php echo $this->pagination->create_links(); ?>
i new folder
admin ,and move file exam.php in folder
admin
error link 1 2 3 > Last. no bold while nick 2 or 3
help please!