title: Get Total Sales by Day in PHP
body: <p>I've never done this before, so im lost here.</p>
  
  <p>I have the following transactions table:</p>
  
  <pre><code>transaction_id  transaction_user    transaction_ammount transaction_time
  1                     2                   950              1318482908
  2                     2                   750              1318482916
  3                     2                   950              1318482939
  </code></pre>
  
  <p>Then, I need to create a query, that helps me pull Weekly data, Grouped by Day so I can create a Chart, you get me?</p>
  
  <p>I've got this so far in PHP that detects the <strong>week number</strong> and prints the complete Week Days (Im using phpbb3): </p>
  
  <pre><code>    $format = 'l'; 
      $ts = time();   // set current Unix timestamp
      $today = date($format, $ts); // set today
      $year = date('o', $ts);
      $week = date('W', $ts);
      $weekdays = 7; 
  
  
      for($i = 1; $i &lt;= $weekdays; $i++) 
      {
          // timestamp from ISO week date format
          $ts = strtotime($year.'W'.$week.$i);
  
          $day = date($format, $ts);
          // test if $day is $today
          if ($day == $today) {
              $day = '&lt;strong&gt;' . $day . '&lt;/strong&gt;';
          }
  
          $template-&gt;assign_block_vars('time', array(
              'DATE'                  =&gt; $day,
          ));
      }
  </code></pre>
  
  <p>Now, I want to arrange the total sales that happened on Monday, Tuesday, .... etc...</p>