用PHP填充HTML表,如何限制每页的行数? [英] HTML table populated with PHP, how to limit rows per page?

查看:72
本文介绍了用PHP填充HTML表,如何限制每页的行数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我通过以下方式填充了html表:

Hello,

I populated a html table this way:

sqlquery = ...
echo "<table width=''100%''><tr>";
 if (mysql_num_rows($result)>0)
 {
         //loop thru the field names to print the correct headers
         $i = 0;
         while ($i < mysql_num_fields($result))
         {
               echo "<th>". mysql_field_name($result, $i) . "</th>";
                  $i++;
           }
           echo "</tr>";

...
 echo "<tr>";
                 foreach ($rows as $data)
                    {
                        echo "<td align=''center''>". $data . "</td>";
...


问题是:在该页面中,我只想显示十行(十个结果),然后在1,2,....下一页,在该表所在的部分中,下一个出现10.结果(行).

我该怎么做呢?我想我必须使用JS,但我不知道该怎么做,因此,我非常感谢您的帮助.


The problem is: in the page I have that table I want to appear only ten rows (ten results), and then I have below a 1,2, .... next page and in that section where table is, appears next 10 results (rows).

How can I accomplish that ? I thing I have to use JS but I dont know how to do it, so I really appreciate your help.

推荐答案

result)> 0) { //循环遍历字段名称以打印正确的标题
result)>0) { //loop thru the field names to print the correct headers


i = 0; while(
i = 0; while (


i&mysql_num_fields(
i < mysql_num_fields(


这篇关于用PHP填充HTML表,如何限制每页的行数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆