php-sql-smarty pagination

寵の児 提交于 2020-01-15 12:14:52

问题


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


回答1:


Here's a simple tutorial on how to code it. The comments discuss solution to additional problems.




回答2:


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.



来源:https://stackoverflow.com/questions/7314794/php-sql-smarty-pagination

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!