Hi,
I am trying to implement pagination into my site but am having a few problems.
This is my code, but when i load the page all the results show and when i click to the next page 2 it shows the same results. It does not seem to be splitting the results between 2 pages.
[PHP]
// required connect
SmartyPaginate: :connect();
// set items per page
SmartyPaginate: :setLimit(20);
$sql = mysql_query("se lect * from users");
while($row = mysql_fetch_arr ay($sql)){
$array[] = $row;
}
// now we get the total number of records from the table
$sql = mysql_query("SE LECT FOUND_ROWS() as total");
$row = mysql_fetch_arr ay($sql, MYSQL_ASSOC);
SmartyPaginate: :setTotal($row['total']);
$smarty->assign("array" , $array);
// assign {$paginate} var
SmartyPaginate: :assign($smarty );
// Assign New Members
$cols_per_row = 4;
$smarty->assign('cols_p er_row', $cols_per_row);
[/PHP]
Can someone help me out?
Cheers,
Adam
I am trying to implement pagination into my site but am having a few problems.
This is my code, but when i load the page all the results show and when i click to the next page 2 it shows the same results. It does not seem to be splitting the results between 2 pages.
[PHP]
// required connect
SmartyPaginate: :connect();
// set items per page
SmartyPaginate: :setLimit(20);
$sql = mysql_query("se lect * from users");
while($row = mysql_fetch_arr ay($sql)){
$array[] = $row;
}
// now we get the total number of records from the table
$sql = mysql_query("SE LECT FOUND_ROWS() as total");
$row = mysql_fetch_arr ay($sql, MYSQL_ASSOC);
SmartyPaginate: :setTotal($row['total']);
$smarty->assign("array" , $array);
// assign {$paginate} var
SmartyPaginate: :assign($smarty );
// Assign New Members
$cols_per_row = 4;
$smarty->assign('cols_p er_row', $cols_per_row);
[/PHP]
Can someone help me out?
Cheers,
Adam
Comment