根据日期回显表的值

时间:2016-07-25 18:01:47

标签: php mysql date

我正在创建一个员工应用程序,以跟踪每个部门的实际员工数量和每个月所需的数量。我想在应用程序运行时跟踪接下来的12个月。我有下表:

id | group_id | group_name         | needed | actual
1  | 1        | Apartments         | 10     | 9
2  | 2        | Apartments Spanish | 12     | 8

到目前为止我的代码:

<?php
    $getgroups = mysqli_query($con, "SELECT * FROM `su_cal_groups`");

    while($groups = mysqli_fetch_assoc($getgroups)) {
        echo "<tr>";
        echo "<td>" . $groups["group_name"] . "</td>";

        echo "<td><span style=\"background-color: red;\" class=\"badge\">" . $groups["actual"] . " / " . $groups["actual"] . "</span></td>";
        echo "<td><span class=\"badge\">" . $groups["actual"] . " / " . $groups["needed"] . "</span></td>";
        echo "<td><span class=\"badge\">" . $groups["actual"] . " / " . $groups["needed"] . "</span></td>";
        echo "<td><span class=\"badge\">" . $groups["actual"] . " / " . $groups["needed"] . "</span></td>";
        echo "<td><span class=\"badge\">" . $groups["actual"] . " / " . $groups["needed"] . "</span></td>";
        echo "<td><span class=\"badge\">" . $groups["actual"] . " / " . $groups["needed"] . "</span></td>";
        echo "<td><span class=\"badge\">" . $groups["actual"] . " / " . $groups["needed"] . "</span></td>";
        echo "<td><span class=\"badge\">" . $groups["actual"] . " / " . $groups["needed"] . "</span></td>";
        echo "<td><span class=\"badge\">" . $groups["actual"] . " / " . $groups["needed"] . "</span></td>";
        echo "<td><span class=\"badge\">" . $groups["actual"] . " / " . $groups["needed"] . "</span></td>";
        echo "<td><span class=\"badge\">" . $groups["actual"] . " / " . $groups["needed"] . "</span></td>";
        echo "<td><span class=\"badge\">" . $groups["actual"] . " / " . $groups["needed"] . "</span></td>";
        echo "<td><span class=\"badge\">" . $groups["actual"] . " / " . $groups["needed"] . "</span></td>";

        // $diff = $groups["needed"] - $groups["actual"];
    //     echo "<td><span class=\"badge\">" . $diff . "</span></td>";
        echo "</tr>";   

    }
    echo "<tr><td><b>Total</b></td>";

        echo "<td><span class=\"badge\">0</span></td>";
        echo "<td><span class=\"badge\">0</span></td>";
        echo "<td><span class=\"badge\">0</span></td>";
        echo "<td><span class=\"badge\">0</span></td>";
        echo "<td><span class=\"badge\">0</span></td>";
        echo "<td><span class=\"badge\">0</span></td>";
        echo "<td><span class=\"badge\">0</span></td>";
        echo "<td><span class=\"badge\">0</span></td>";
        echo "<td><span class=\"badge\">0</span></td>";
        echo "<td><span class=\"badge\">0</span></td>";
        echo "<td><span class=\"badge\">0</span></td>";
        echo "<td><span class=\"badge\">0</span></td>";
        echo "<td><span class=\"badge\">0</span></td>";


        echo "</tr>";     


    ?>

我只是坚持如何将需要和实际与不同月份联系起来。我所追求的结果显示在下面的模型中

Mockup

0 个答案:

没有答案