我目前正在自己创建一个项目,到目前为止一切都很顺利,但在更改了一些代码后,我的网格看起来并不像我想要的那样。你可以看到应该有3列,而不是只有一列,我无法弄清楚为什么会这样。
提前致谢!
<div class="col-sm-4">
<h4 class="card-title">Misiuni Active</h4>
<div class="row">
<?php
$today = date("Y-m-d");
$result = mysqli_query($conn,"SELECT * FROM misiuni");
if(mysqli_num_rows($result)){
while ($row = mysqli_fetch_assoc($result)) {
if ($today < $row['deadline']) {
echo '<form method="POST" action="accept.php">';
echo '<div class="ribbon-wrapper card">';
echo '<input type="hidden" name="titlu" value="' . $row['titlu'] . '"></input>';
echo '<div class="ribbon ribbon-default">' . $row['titlu'] . '</div>';
echo '<p class="ribbon-content">' . $row['misiune'] . '</p>';
echo '<center><br><h4 class="card-title">Reward:</h4></center>';
echo '<center><img src=' . $row['reward'] . ' width="200px" height="200px"></center>';
$sql = mysqli_query($conn,"SELECT * FROM misiuni_acceptate where username='". $_SESSION['username'] . "' AND titlu_misiune='". $row['titlu'] . "'");
if(mysqli_num_rows($sql)){
while ($row = mysqli_fetch_assoc($sql)) {
if($row['status']=='yes'){
echo '<input type="submit" class="btn btn-info" value="Misiune finalizată" disabled>';
}else {
echo '<input type="submit" class="btn btn-warning" value="Misiune în curs" disabled>';
}
}
}else {
echo '<input type="submit" class="btn btn-success" value="Acceptă misiunea">';
}
echo '</div>';
echo '</div>';
echo '</form>';
}
}
}
?>
</div>
</div>
答案 0 :(得分:0)
<div class="row">
<h4 class="card-title">Misiuni Active</h4>
<?php
$today = date("Y-m-d");
$result = mysqli_query($conn,"SELECT * FROM misiuni");
if(mysqli_num_rows($result)){
while ($row = mysqli_fetch_assoc($result)) {
if ($today < $row['deadline']) {
echo '<div class="col-xs-6 col-sm-3">'
echo '<form method="POST" action="accept.php">';
echo '<div class="ribbon-wrapper card">';
echo '<input type="hidden" name="titlu" value="' . $row['titlu'] . '"></input>';
echo '<div class="ribbon ribbon-default">' . $row['titlu'] . '</div>';
echo '<p class="ribbon-content">' . $row['misiune'] . '</p>';
echo '<center><br><h4 class="card-title">Reward:</h4></center>';
echo '<center><img src=' . $row['reward'] . ' width="200px" height="200px"></center>';
$sql = mysqli_query($conn,"SELECT * FROM misiuni_acceptate where username='". $_SESSION['username'] . "' AND titlu_misiune='". $row['titlu'] . "'");
if(mysqli_num_rows($sql)){
while ($row = mysqli_fetch_assoc($sql)) {
if($row['status']=='yes'){
echo '<input type="submit" class="btn btn-info" value="Misiune finalizată" disabled>';
}else {
echo '<input type="submit" class="btn btn-warning" value="Misiune în curs" disabled>';
}
}
}else {
echo '<input type="submit" class="btn btn-success" value="Acceptă misiunea">';
}
echo '</div>';
echo '</div>';
echo '</form>';
echo '</div>';
}
}
}
?>