我使用以下代码以表格的形式显示数据
echo "<table id='admin'>
<tr>
<th>ID</th>
<th> Name </th>
th>Email</th>
<th>Headline</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>" ;
echo "<td>" . $row['id'] ."</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['headline'] . "</td>";
echo "</tr>";
}
我发现了许多类似的问题,但他们主要显示超链接和简单的回声,他们的解决方案对我不起作用。我想要在这一行中打印数据,即echo "<td>" . $row['name'] . "</td>";
也应该表现为超链接并重定向到另一个页面。我试图插入href链接后,但它显示语法错误。任何帮助,将不胜感激
`
答案 0 :(得分:2)
喜欢这个
echo "<table id='admin'>
<tr>
<th>ID</th>
<th> Name </th>
th>Email</th>
<th>Headline</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>" ;
echo "<td><a href='#'>" . $row['id'] ."</a></td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['headline'] . "</td>";
echo "</tr>";
}
答案 1 :(得分:1)
echo "<td><a href='link'>" . $row['name'] . "</a></td>";
答案 2 :(得分:0)
echo "<td><a href='other.php'>" . $row['name'] . "</a></td>";
而且,
th>Email</th>
用
替换它<th>Email</th>