gpt4 book ai didi

mysql - 在bootstrap表中显示mysql的内容

转载 作者:行者123 更新时间:2023-11-29 23:26:12 25 4
gpt4 key购买 nike

我实际上正在尝试在 Bootstrap 表中显示我的 mysql 表的内容。

我可以看到内容,但它只显示第一个内容,其他内容不在表格内。这里哪里错了?

实际看起来如何:

我的表.php

  <?php 
include('config/mysql.php');
$result = mysql_query("SELECT * FROM streams");
echo mysql_error();

?>
<link rel="stylesheet" href="views/extra.css" />

<table class="tablesorter" cellspacing="0" >
<thead>
<tr>
<th class="header">ID</th>
<th class="header">Name</th>
<th class="header">Port</th>
<th class="header">Options</th>
</tr>
</thead>

<tbody>
<?php while ($row = mysql_fetch_array($result)) { ?>
<tr>
<td bgcolor="#D1FFC2"><?php echo $row["id"] ?></td>
<td bgcolor="#D1FFC2"><?php echo $row["streamname"] ?></td>
<td bgcolor="#D1FFC2"><?php echo $row["streamport"] ?></td>
<td bgcolor="#D1FFC2">Debug- Delete- Edit</td>
</tr>
</tbody>
</table>


<?php } ?>

最佳答案

将其从 while $row = mysql_fetch_array($result) 循环中取出并将其放在末尾之后。

 </tbody> 
</table>

并考虑使用 mysqlI 或 PDO,因为 mysql 函数已贬值并将消失。

关于mysql - 在bootstrap表中显示mysql的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26939303/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com