我对此非常陌生,包括这个社区,所以我将欣赏最简单的答案和令人难忘的细分。我有以下代码:
<?php
$link = mysqli_connect("localhost", "demo_lesson", "live@lesson1",
"demo_lesson");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* Select all return result */
if ($result = mysqli_query($link, "SELECT * FROM resulttable where id != '0'
ORDER BY id DESC") ) {
$row = mysqli_fetch_array($result);
$id = $row["id"];
$email = $row["email"];
$phone= $row["phone"];
$ip = $row["ip"];
$date = $row["date"];
echo '<table width = "100%" border = "1" cellspacing = "1" cellpadding =
"1">
<caption><h1>List of all Results from result Table</h1></caption>
<thead>
<tr>
<th>Id</th>
<th>Email</th>
<th>Phone</th>
<th>Ip</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td> <center> '. $row['id'] .' </center></td>
<td> <center> '. $row['email'] .' </center></td>
<td> <center> '. $row['phone'] .' </center></td>
<td> <center> '. $row['ip'] .' </center></td>
<td> <center> '. $row['date'] .' </center></td>
</tr>
</tbody>
</table>';
} else {'<p>There are currently no resulttable in the system.</p>';}
$result->free();
mysqli_close($link);
?>
我已经进行了搜索并找到了迄今为止帮助我的答案,但我无法解决这个问题。我得到的只是一行结果,而不是表格中的所有内容。