我正在阅读我拥有的书中的教程,但想在表格中添加一些额外的列。我已经添加了列,买入和卖出,并且在每个列中我想显示一个按钮。我不确定如何做到这一点,这可能吗?
这是我在表格页面中的代码:
<?php // Example 21-9: members.php
include_once 'header.php';
if (!$loggedin) die();
echo "<div class='main'>";
$con=mysqli_connect("localhost","root","usbw","stocktrading");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM stocks");
echo "<table border='1 '>
<tr>
<th>ID</th>
<th>Name</th>
<th>Price</th>
<th>Buy</th>
<th>Sell</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['price'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>