html页面中的分页

时间:2017-11-13 15:46:37

标签: php html datatable

我在行中显示所有产品,但我使用的代码在列中显示结果。我正在使用数据表分页,我不知道我如何在我的网站上使用分页请帮助我。 enter image description here

const path = require('path');
path.join(process.cwd()

ex: 
"rxjs/AsyncSubject": path.join(process.cwd(), "/node_modules/rxjs/_esm5/AsyncSubject.js")

2 个答案:

答案 0 :(得分:0)

基本上,您的代码是一个循环:

<table  id="datatables" class="table no-margin">
  <thead><tr><th></th></tr></thead>
  <tbody class="df">
    <?php 
        $pr = mysqli_query($link,"select * from product where company_id = '".$company_id."'");
        while($prd = mysqli_fetch_array($pr))
        {
     <tr>           
      <td>
         {{some display logic}}
      </td>
      <div class="clearfix">
      </div>
 </tr>     
 <?php } ?>                         

如果您希望您的产品在一行中修复它,那么不会创建新行

<table  id="datatables" class="table no-margin">
  <thead><tr><th></th></tr></thead>
  <tbody class="df">
     <tr>         
    <?php 
        $pr = mysqli_query($link,"select * from product where company_id = '".$company_id."'");
        while($prd = mysqli_fetch_array($pr))
        {

      <td>
         {{some display logic}}
      </td>
      <div class="clearfix">
      </div>
      <?php } ?>       
 </tr>     

答案 1 :(得分:0)

只需将你的标记放在while循环之外

<tr>
 while($prd = mysqli_fetch_array($pr))
   {

<td> Your Values </td>

}
</tr>
相关问题