[eluser]sumit270[/eluser]
I am just staring to learn codeigniter. and with the help of user guide i managed to create the following page. but the pagination doesn't seem to work for me.
please help!
Code:
<?php
class Classref extends Controller {
function Classref()
{
parent::Controller();
}
function index($from ='0',$to='10'){
$this->load->database();
$this->load->library('pagination');
//echo $this->db->count_all('generatedata');
$config['base_url'] = site_url("labs/classref/index");
$config['total_rows'] = $this->db->count_all('generatedata');
$config['per_page'] = '20';
$this->pagination->initialize($config);
echo $this->pagination->create_links();
$query = $this->db->query("SELECT firstname, lastname, email, phone, city, state, country, street_address FROM generatedata LIMIT $from, $to");
echo "<dl>";
foreach ($query->result() as $row)
{
echo "<dt><b>" . $row->firstname . " " . $row->lastname . "</b></dt>";
echo "<dd> Email: " . $row->email . "</dd>";
echo "<dd> Phone: " . $row->phone . "</dd>";
echo "<dd> Street Address: " . $row->street_address . "</dd>";
echo "<dd> City: " . $row->city . "</dd>";
echo "<dd> State: " . $row->state . "</dd>";
echo "<dd> Country: " . $row->country . "</dd> <br />";
}
echo "</dl>";
echo 'Total Results: ' . $query->num_rows();
}
}