[英]single line break In while loop
I would like to have a single <br>
in my while loop. 我想在while循环中有一个<br>
。 If I add the <br>
I get a <br>
for single item, what I want is that only <br>
is shown between <img>
and <button>
. 如果添加<br>
可以得到单个项目的<br>
,我想要的是<img>
和<button>
之间仅显示<br>
。 So not for every button separately. 因此,并非每个按钮都单独使用。 Can someone help me? 有人能帮我吗?
<?php
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc())
{
?>
<img src="<?php echo $result_question['img'];?>">
<input type="button" id="<?php echo $row["answer_id"];?>" next_question_id="<?php echo $row["next_question_id"];?>" value="<?php echo $row["answer_text"];?>" onclick=myFunction2((this.id));>
<?php
}
}
$conn->close();
?>
is this what you mean? 你是这个意思吗?
<?php
if ($result->num_rows > 0) {
$c = 0;
// output data of each row
while($row = $result->fetch_assoc())
{
?>
<img src="<?php echo $result_question['img'];?>">
<?php if ($c == 0){ ?><br/><?php } ?>
<input type="button" id="<?php echo $row["answer_id"];?>" next_question_id="<?php echo $row["next_question_id"];?>" value="<?php echo $row["answer_text"];?>" onclick=myFunction2((this.id));>
<?php
$c++;
}
}
$conn->close();
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.