我正在尝试使用php显示来自mysql的数据。请找到我使用过的代码。我只在输出中获取字段名称。查询中的引用表包含超过50行。 请帮助解决我的问题...
<?php
$con=mysqli_connect("localhost","root","password","ayrilmana");
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT txn_amount,donated_by FROM tempe_txn");
echo "<table border='1'>
<tr>
<th>txn_amount</th>
<th>donated_by</th>
</tr>";
if($result === FALSE){
die(mysql_error());
}
while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['txn_amount'] . "</td>";
echo "<td>" . $row['donated_by'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>