我有两个div class="row" >
<div class="col-md-12">
enter code here
<h1 id="username" style="color:white;text-align:center" >
<?php
if ($result->num_rows > 0){
$row = $result->fetch_assoc();
echo $row["username"];}
?>
</h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h1 id="bash" style="color:blue;text-align:center">
<?php
if ($result->num_rows > 0){
$row = $result->fetch_assoc();
echo $row["bash"];}
?>
</h1>
</div>
</div>
代码,两个都在同一页面上,但只有第一个运行。什么似乎是问题?
代码:
float angle = 0;
public void draw() {
if (angle > 359) {
angle = 0;
}
ellipse(0, sin(radians(angle)) * height, 20, 20);
angle++;
}
答案 0 :(得分:0)
首先,请务必正确打开和关闭HTML标记。然后将您的代码更改为以下内容:
<?php
$username = null;
$bash = null;
if ($result -> num_rows > 0) {
$row = $result->fetch_assoc();
$username = $row["username"];
$bash = $row["bash"];
}
?>
<div class = "row" >
<div class = "col-md-12">
enter code here
<h1 id = "username" style = "color:white; text-align:center">
<?= $username ?> <!-- OR --> <?php echo $username; ?>
</h1>
</div>
</div>
<div class = "row">
<div class = "col-md-12">
<h1 id = "bash" style = "color:blue; text-align:center">
<?= $bash ?> <!-- OR --> <?php echo $bash; ?>
</h1>
</div>
</div>
h1
标签 旁注:<?= $variable ?>
适用于版本&lt;必须在 php.ini
文件中启用PHP 5.4 ,短标记。