Thursday, February 19, 2009

Paging using PHP and MSSQL SERVER 2005 with Code Igniter

okay just to add some note.. here

some dude from code igniter forum create a simple function to make pagination....

i think this function will work great with all database. and you dont havta use code igniter framework.

im currently using php and mssql server 2005 with Code Igniter Framework
and it works well with the function...

just view it here
code igniter forums
and this is the query that i used :

function get_list($offset){
$sql = "
select top (20) from (
select id,name, ROW_NUMBER() over (order by id) as Result_Number from tm_person) innerSel Where Result_Number >(($offset - 1) *20) Order by Result_Number
$results = $this->db->query($sql);
return $results->result_array();

$offset is number of page values you want to display
and dont forget the paging function read it here code igniter forums

No comments: