【问题标题】:Show user list that looks like eCommerce product list format in php在 php 中显示类似于电子商务产品列表格式的用户列表
【发布时间】:2017-11-30 19:28:45
【问题描述】:

我正在创建用户管理系统仪表板,我想在其中显示我的用户列表,如电子商务网站产品列表

我的php代码是。

<?php  
 $connect = mysqli_connect("localhost", "root", "xxxxx", "xxxxx");  
 $query = "SELECT * FROM users";  
 $result = mysqli_query($connect, $query);  
 ?> 


       <div  style="width:700px;">  
            <div class="table-responsive">  
                 <table class="table table-bordered">  
                      <tr> 

                           <th width="20%">Location</th> 
                           <th width="20%">Employee Name</th>  
                           <th width="30%">Last Login</th>
                           <th width="30%">View</th>  
                      </tr>  

                      <?php  

                      while($row = mysqli_fetch_array($result)) 

                      {  

                      ?>  

                      <tr> 
                          <td><?php echo $row["Location"]; ?></td> 
                           <td><?php echo $row["userName"]; ?></td>
                           <td><?php echo $row["session"]; ?></td>  
                           <td><input type="button" name="view" value="view" id="<?php echo $row["userEmail"]; ?>" class="btn btn-info btn-xs view_data" /></td>  

                      </tr>  

                      <?php  
                      }  
                      ?>  

                 </table>  
            </div>  
       </div> 

我希望我的用户输出看起来应该是动态的。

User-1 | User 2   | User 3   | User 4
User-5 | User 6   | User 7   | User 8
User-9 | User 10  | User 11  | User 12 

请帮忙。

【问题讨论】:

  • 可以使用引导网格布局代替表格。

标签: php jquery html


【解决方案1】:

请勿使用表格来构建您的网站/网络应用程序。您可以使用例如 Bootstrap 轻松实现响应式设计。你应该使用 Bootstrap 的grid system

你可以这样使用:

<div class='container'>
 <div class=row>
   <div width="20%">Location</div> 
   <div width="20%">Employee Name</div>  
   <div width="30%">Last Login</div>
   <div width="30%">View</div>  
 </div>
  <?php  
      while($row = mysqli_fetch_array($result)) 
      {
        echo "<div class='col-md-4'>".$yourDataHere."</div>
      }
  ?> 
</div>

【讨论】:

    猜你喜欢
    • 2012-05-06
    • 1970-01-01
    • 2023-01-29
    • 2019-07-19
    • 1970-01-01
    • 1970-01-01
    • 2017-12-16
    • 2021-10-30
    • 2015-07-03
    相关资源
    最近更新 更多