这里有一个代码,它使用echo在数据库中显示我的表的内容。我的问题是我不知道任何方法来显示它的页面,因为它显示所有的数据。这是我当前的php代码
<table border="0" cellspacing="0" cellpadding="4" class="tablecontainer">
<tr>
<td class="table_titles">ID</td>
<td class="table_titles">Date and Time</td>
<td class="table_titles">Frequency</td>
<td class="table_titles">Wave Height</td>
<td class="table_titles">Longitude</td>
<td class="table_titles">Latitude</td>
</tr>
<?php
include('connection.php');
$result = mysqli_query($con,'SELECT * FROM data ORDER BY id DESC');
$oddrow = true;
while($row = mysqli_fetch_array($result))
{
if ($oddrow)
{
$css_class=' class="table_cells_odd"';
}
else
{
$css_class=' class="table_cells_even"';
}
$oddrow = !$oddrow;
echo "<tr>";
echo "<td '.$css_class.'>" . $row['id'] . "</td>";
echo "<td '.$css_class.'>" . $row['date_time'] . "</td>";
echo "<td '.$css_class.'>" . $row['height'] . "</td>";
echo "<td '.$css_class.'>" . $row['frequency'] . "</td>";
echo "<td '.$css_class.'>" . $row['latitude'] . "</td>";
echo "<td '.$css_class.'>" . $row['longitude'] . "</td>";
echo "</tr>";
}
mysqli_close($con);
?>
</table>
1条答案
按热度按时间kulphzqa1#
您需要将yourfile.php替换为实际文件