在从数据库

时间:2017-12-10 19:30:00

标签: php html mysql mysqli

第二列(子表)未在主表中显示。 如果我从sql数据库中删除数据然后它显示。有什么问题?我尝试了所有可能的解决方案。

第一个子表从数据库中获取数据 第二个子表没有显示.. 也试过while循环

<table>
  <thead>
     <tr>
            <th width="33%"> mt</th>
            <th width="33%"> send</th>
          </tr>
        </thead>
        <tbody>
<tr>
<td>
<table>
  <thead>
    <tr>
      <th width="5%"> No </th>
      <th width="14%"> col1 </th>
      <th width="8%"> col2 </th>
    </tr>
  </thead>
  <tbody>
    <?php $res = mysqli_query($link,"select * from type")or die (mysql_error());
	$srn=1;
	for($i=0;$fs = mysqli_fetch_assoc($res)or die (mysql_error());$i++){?>
    <tr>
      <td><?php echo $srn; $srn++; ?></td>
      <td><?php echo $fs["type"]; ?></td>
      <td><a href="editproduct.php?id=<?php echo $fs['type']; ?>">
        <button class="btn btn-warning"></button>
        </a> <a href="deleteproduct.php?id=<?php echo $fs['type']; ?>">
        <button class="btn btn-danger"></button>
        </a> </td>
    </tr>
    <?php } ?>
  </tbody>
</table>
</td>
<td> 
  <table>
    <thead>
      <tr>
        <th width="5%"> no </th>
        <th width="14%"> col1 </th>
        <th width="8%"> col2 </th>
      </tr>
    </thead>
    <tbody>
      <tr class="record">
        <td>1</td>
        <td>2</td>
      </tr>
    </tbody>
  </table></td>
</tr>
</tbody>
</table>

0 个答案:

没有答案