在PHP中计算SUM

时间:2017-11-26 08:43:42

标签: php mysql sql

<?php

 $today=date('Y-m-d');
  $sorgu = mysqli_query($conn, "SELECT * FROM urun");
  while ($sira = mysqli_fetch_array($sorgu)) {
  $urun = $sira['urun'];

  $query = mysqli_query($conn, "SELECT product_name, birim, SUM(quantity) FROM 
  product WHERE product_name = '$urun' AND quantity != '0' AND quantity > '0' 
  AND grup!='uygulama' AND skt > '$today' GROUP BY product_name, birim ");

  while ($row = mysqli_fetch_array($query)){
  if ($row['2'] <= $sira['minstok']) {

  echo count($row['0']);

} } } ?>

此代码属于具有通知系统的表。我希望通知部分在该表中的行号增加时增加但是它变为11111111 ...,那么如何让代码给我总和呢?

1 个答案:

答案 0 :(得分:0)

顺便提一下,FixtureTest以外的所有内容都可以按如下方式重写:

while ($row...