0

我有我的 sql server 连接

$sql_exp = "select * from dbo.PC inner join dbo.FA_PC on dbo.PC.PCID = dbo.FA_PC.PCID WHERE UserID is NOT NULL order by dbo.fa_pc.PCID"; 
   $sql_exp1= "select * from dbo.users inner join dbo.FA_PC on dbo.users.UserID = dbo.FA_PC.UserID order by dbo.fa_pc.PCID";
    $sql_exp2 = "select * from dbo.FA_Type inner join dbo.FA_PC on dbo.FA_Type.FA_TypeID = dbo.FA_PC.FA_TypeID order by dbo.fa_pc.PCID"; 
   $rs = $conn->Execute($sql_exp);
    $rs1 = $conn->Execute($sql_exp1);
  $rs2 = $conn->Execute($sql_exp2);
   echo "<table border='1' cellpadding='1' cellspacing='0' id='rounded-corner'><tr><th>Desktop Number</th><th>Employee</th><th><p align=left>Fixed Asset Accountability</p></th></tr>";
   echo '<select name="print">'; 
   echo "<option value=".$rs->Fields("PC_Number")."> </option>";
   while (!$rs->EOF) {
       set_time_limit(0);


       echo "<td>CP # <br>".$rs->Fields("PC_Number")."</td>";   
       echo "<td>".$rs1->Fields("EmployeeName")."</td>";    
      echo "<td>".$rs2->Fields("FA_Type")."</td><tr>";  

      $rs->MoveNext();
      $rs1->MoveNext();
      $rs2->MoveNext();
   }
   echo "</table>";   
   $rs->Close();
   $rs1->Close();
   $rs2->Close();  

所以这段代码只会打印我数据库中的每一个数据,大约100个细节,我怎么能把输入的数据限制为10、20、30、40、50、100,只为剩余的数据添加几个下一页和上一页链接很可能是类似表格的gridview

4

1 回答 1

0

尝试放一个LIMIT. 例如对于第 1LIMIT 0, 10页、第 2LIMIT 10,10页、第 3 页 'LIMIT 20, 10',等等等等……

在哪里LIMIT 0(page), 10(max content shows)

于 2013-04-08T07:44:18.197 回答