我正在尝试在我的数据库的表格中显示我的数据,我对另一个表使用完全相同的代码,但出于某种原因,表格显示但是为空。
谢谢它解决了!
答案 0 :(得分:0)
你必须在while循环,关闭标记和最后一个:
中放置括号echo "<table border=1 cellpadding=5>";
echo "<tr>";
echo "<th>Workshop Name</th>";
echo "<th>Workshop Price (£)</th>";
echo "<th>Workshop Description</th>";
echo "<th>Further Information</th>";
echo "</tr>";
$SQL="select workshopId,workshopName, workshopPrice,workshopDescription from Workshops order by workshopId";
$exeSQL=mysql_query($SQL) or die (mysql_error());
while ($arrayworkshop=mysql_fetch_array($exeSQL))
{
echo "<tr>";
//display details
echo "<td>".$arrayworkshop['workshopName']."</td>";
echo "<td>".$arrayworkshop['workshopPrice']."</td>";
echo "<td>".$arrayworkshop['workshopDescription']."</td>";
echo "<td><a href='ViewWorkshop.php?workshopId=".$arrayworkshop['workshopId']."'>";
//Display name of the Task
echo "Further Information"."</a></td>";
echo "</tr>";
}
echo "</table>";