我需要回显 SQL 列中的所有行。
这是我的PHP
$query2="SELECT * FROM field_activity WHERE field_id='$fetch'";
$result2 = mysql_query($query2);
while($row = mysql_fetch_array($result2)){
$activity = $row['activity'];
$cr_date = date_create($row['date']);
$for_date = date_format($cr_date, 'F j, Y');
$amount = $row['amount'];
$acres_complete = $row['acres_complete'];
$duration = $row['duration'];
$status = $row['status'];
}
这是我的 HTML 输出..
<?php
{
echo "<tr>";
echo "<td width='16%'><strong>Date</strong></td>";
echo "<td width='16%'>$for_date</td>";
echo "</tr><tr>";
echo "<td width='16%'><strong>Activity</strong></td>";
echo "<td width='16%'>$activity</td>";
echo "</tr><tr>";
echo "<td width='16%'><strong>Amount</strong></td>";
echo "<td width='16%'>$amount</td>";
echo "</tr><tr>";
echo "<td width='16%'><strong>Acres Complete</strong></td>";
echo "<td width='16%'>$acres_complete</td>";
echo "</tr><tr>";
echo "<td width='16%'><strong>Duration</strong></td>";
echo "<td width='16%'>$duration</td>";
echo "</tr><tr>";
echo "<td width='16%'><strong>Status</strong></td>";
echo "<td width='16%'>$status</td>";
echo "</tr>";
}
?>
这仅显示列中的一行(最新行)..我希望它显示所有行..