我正在写一个论坛,我的PHP代码在一个简单的行上显示了所选列的所有记录。
代码:
<td bgcolor="#FAB1CA">
<?php
$link = mysqli_connect("xxxx", "xxx", "xxxx", "xxxxxx");
if ($link === false) {
die("ERROR: Could not connect. " . mysqli_connect_error());
}
if (isset($_SESSION['logged'])) {
$sql = "Select ID from forum_question ORDER by id DESC";
$result = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($result)) {
$show = $row['ID'];
print_r($show);
}
}
mysqli_close($link);
?>
</td>
答案 0 :(得分:0)
<td bgcolor="#FAB1CA">
<?php
$link = mysqli_connect("xxxx", "xxx", "xxxx", "xxxxxx");
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
if(isset($_SESSION['logged'])){
$sql= "Select ID from forum_question ORDER by id DESC";
$result = mysqli_query($link, $sql);
while($row = mysqli_fetch_assoc($result)){
$show = $row['ID'];
print_r($show);
echo"<br />";
}
}
mysqli_close($link);
?>
</td>
请回显一个“ br”标签。希望您的问题得到解决。