小编vin*_*nod的帖子

使用PHP以HTML格式从表格式获取和显示数据库中的数据

我已经完成了获取和显示数据.但问题是,它在html表的同一行显示获取行的数据.例如:我想要像这样显示

                  ID | Name | Desination
                   ......................
                   1 | ABC | Developer
                   2 | PQR | Tester
                   3 | XYZ | Developer
Run Code Online (Sandbox Code Playgroud)

但其显示为 -

                   ID | Name | Desination
                   ......................
                    1 | ABC | Developer   2 | PQR | Tester   3 | XYZ | Developer
Run Code Online (Sandbox Code Playgroud)

我做过类似的事 -

$sql = " SELECT candidate.cand_number,candidate.cand_fname,candidate.cand_desc FROM candidate ".$join.' where '.$condition;
$result = mysql_query($sql) or die(mysql_error()); 
Run Code Online (Sandbox Code Playgroud)

用表格的显示格式纠正我.

 <div class="box-body table-responsive no-padding">
     <table class="table table-hover">
          <tr>
              <th>ID</th>
              <th>Name</th>
              <th>Designation</th>
          </tr>
          <tr>
              <?php

                   If(mysql_num_rows($result)>0)
                   {
                     while($row=mysql_fetch_array($result)) …
Run Code Online (Sandbox Code Playgroud)

html php

0
推荐指数
1
解决办法
5万
查看次数

标签 统计

html ×1

php ×1