如何从当月的第一个日期到当月的当前日期从当月的数据库中计算数据

时间:2020-09-10 05:11:20

标签: php html mysql

此代码的问题是它计算数据库中所有月份的所有数据。不是从本月的本月第一天到本月的当前日期……有人可以帮我吗。

<tbody>
    <?php
                                    
      $FullTotal = 0;
      while($rowF = $resultX -> fetch_assoc()){// registerfighter
          $totalPlus = 0;
          //table start
    ?> 
    <tr> 
       <td><?php echo $rowF["UserName"] ?></td>  
       <?php
            $resultY-> data_seek(0);
            while($rowY = $resultY -> fetch_assoc()){ // by addplan
                $resultR -> data_seek(0);
                while($rowR = $resultR -> fetch_assoc()){ // by record
                    if ($first_date <= $rowR["SubmitDate"]  && $last_date <= $rowR["SubmitDate"]){
                    // this the problems...it not work
                        if( ($rowF["UserID"]===$rowR["UserIDD"])  and
                            (($rowR["No_Plan"]) === '1' and 
                            ($rowY["No_Plan"] === $rowR['No_Plan']))) {
                                $total = ($rowR["UserInputNEW"] + $rowR["UserInputNMP"]);
                                $totalPlus = $totalPlus + $total;
                                $FullTotal = $FullTotal + $total;
                          }
                    }
               }
          }
      ?> 
         <td><?php echo $totalPlus; ?></td>
     </tr> 
     <?php
         //table end
      } ?>
         <td colspan="1"> Total  </td> 
         <td colspan="1"> <?php echo $FullTotal?></td> 
   </tbody>

0 个答案:

没有答案