这是一些简短的表格代码。我在表格中使用了echo。
数据未打印为前三个字段。
ui-view
表输出图像
答案 0 :(得分:0)
您在每个动态数据中都错过了tr。更改您的代码如下:
echo "<table>";
echo "<tr>
<th>ID</th>
<th>Date</th>
<th>Reference</th>
</tr>" ;
while ($row = $result->fetch_object())
{
echo "<tr><td>" . $row->id . "</td>";
echo "<td>" . $row->date . "</td>";
echo "<td>" . $row->ref . "</td></tr>";
}
echo " <tr>
<th>First Name</th>
<th>Father Name</th>
<th>Phone</th>
</tr>";
while ($row = $result->fetch_object())
{
echo "<tr><td>" . $row->name . "</td>";
echo "<td>" . $row->fname . "</td>";
echo "<td>" . $row->cell . "</td></tr>";
}
echo "<tr>
<th>District</th>
<th>Address</th>
<th>Gender</th>
</tr>";
while ($row = $result->fetch_object())
{
echo "<tr><td>" . $row->district . "</td>";
echo "<td>" . $row->address . "</td>";
echo "<td>" . $row->gender . "</td></tr>";
}
echo "</table>";