[英]How To Fix While Loop output results
I just want to get the results of while loop which is within a php in different lines我只想得到 php 中不同行的 while 循环的结果
if($count == 0){
$output = 'THERE WAS NO RESULTS';
}
else{
while($row = mysqli_fetch_array($query)){
$des = $row['description'];
$file = $row['name'];
$output ='<div>'.$des. '</div>';
echo "<td>";
echo "$output";
echo "<a href='".$file."'>Download</a></td>";
}
}
}
echo "</table>";
?>
I am getting all the results in the same line itself.我在同一行中获得所有结果。
Are you missing the table row tag?您是否缺少表格行标记? <tr>
if($count == 0){
$output = 'THERE WAS NO RESULTS';
}
else{
echo '<table>';
while($row = mysqli_fetch_array($query)){
$des = $row['description'];
$file = $row['name'];
echo '<tr>';
echo '<td><div>'. $des .'</div></td>';
echo '<td><a href='".$file."'>Download</a></td>';
echo '</tr>';
}
echo '</table>';
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.