php-sql-smarty pagination
I have the following code :
$gemng = $db->query("SELECT * FROM students ORDER BY student_name ASC ");
while($ftmng = $db->fetch_array($gemng))
{
$magn[] = $ftmng;
}
$tpl->assign('mn', $magn);
$db->free_result($gemng);
I want to display a result with only 20 student not more than that. and display others in pages. how can I do that ... can you fix the code and add the pagination code to it ? do not worry about开发者_开发百科 the html file I will take care of it
Here's a simple tutorial on how to code it. The comments discuss solution to additional problems.
For the Smarty 2 you can use Paginate addon. For the Smarty 3 I do not know ready to use solutions but you can convert it, just a good starting point to become a smarty guru.
精彩评论