【问题标题】:How can I display an amount of units in my table with the same value?如何在表格中显示具有相同值的单位数量?
【发布时间】:2015-08-16 09:54:34
【问题描述】:

您好,我正在制作一个带有标记的 Web 应用程序。我想在我的导航中显示一种通知圈,里面有一个数字,约会的数量会显示在地图上。在我的数据库中,它们的值是 0 表示未完成,1 表示已完成。该值显示在下图中的状态下。我想在我的 div 中显示值为 0 的约会数量。我不知道怎么回事..

这是我的主文件中的代码(带有导航):

<ul>
    <li>
        <a class="navi current-page" href="main.php"><i class="ion-map icons"></i>Kaart<div class="rondje"><?php include'notifications.php'; ?></div></a>
    </li>
    <li><a class="navi" href="overzicht.php"><i class="ion-ios-list icons"></i>Overzicht</a></li>
    <li><a class="navi" href="instructie.html"><i class="ion-help-circled icons"></i>Handleiding</a></li>
    <li><a class="navi" href="index.html" onclick="return confirm('Ben je zeker dat je wilt uitloggen?')"><i class="ion-log-out icons"></i>Log uit</a></li>
</ul>

这就是我认为在 php 中的内容:

while ($markers = mysql_fetch_assoc($records)) {
    echo "<p>";
    echo $markers['status'];
    echo "</p>";        
}

【问题讨论】:

  • 我自己差点找到了

标签: php html sql database localhost


【解决方案1】:

我找到了适合自己的东西。

<?php
$query="SELECT COUNT(*) FROM markers WHERE Status=0 AND DATE (dag) = CURDATE()";
$results = mysql_query($query);


while ($row = mysql_fetch_array($results)) {
    echo '<div class="rondje">';
    foreach($row as $field) {
        echo '<p>' . htmlspecialchars($field) . '</p>';
    }
    echo '</div>';
}
?>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-06-22
    • 2017-05-23
    • 2020-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多