title: MYSQL and PHP calculate total price of orders table every day and every month, populate new summary table
body: <p>I have orders table on my DB (id_order, price, desc, delivery)
  I need to calculate total price for each day</p>
  
  <p>I use this</p>
  
  <pre><code>$date = date("Y-m-d"); 
  
  $query55 = "SELECT id_order, price FROM orders WHERE delivery LIKE '%$date%'";
  $result55 = mysql_query($query55) or die(mysql_error());
  
  while ($row55 = mysql_fetch_array($result55))
  {
  $currency = $row55['id_currency'];
  $id = $row55['id_order'];
  
      if ($currency == "1")
  {
      echo '
          &lt;tr&gt;
          &lt;td style="width: 120px;"&gt;' . $id_order . '&lt;/td&gt;
          &lt;td style="width: 120px;"&gt;EUR&lt;/td&gt;
          &lt;td style="width: 170px;"&gt;' . $row55['price'] . '&lt;/td&gt;
          &lt;/tr&gt;
  
  ';
          $somma_paid += $row55['price'];
  
  }
  </code></pre>
  
  <p>and it works</p>
  
  <p>At the end i have total day on variable $somma_paid.</p>
  
  <p>I'd like to do it for each days of the year, in automatic. Becouse I need montly total.
  I need 30/31 rows with each 30/31 totals day</p>
  
  <p>every day I must execute this script. Can I modify it for ask montly total every time for every month. I think that i did not explain it very well...</p>
  
  <p>Another: I can do it with single day, can I do it for all year days before today?</p>
  
  <p>I made another table with all year date and this field (date, price)
  I think to populate this new table for new ask..</p>