title: Create Array from Mysql data for Flot
body: <p>I have a problem in that I can't get an array into an array. </p>
  
  <p>The outcome should look like this:</p>
  
  <pre><code>$data=array(
    array(
       'label' =&gt; 'Totals',
       'color' =&gt; '#745fa4',
       'data' =&gt; 
      array(
        array('01/01/2015', 125),
        array('02/01/2015', 148),
        array('03/01/2015', 42),
        array('04/01/2015', 115),
        array('05/01/2015', 45),
        array('06/01/2015', 77),
        array('07/01/2015', 59)
      )
    ),
  );
  </code></pre>
  
  <p><strong>I currently have this but can't get it into the correct format:</strong></p>
  
  <pre><code>$result = mysqli_query($con,"SELECT * FROM table ORDER BY id DESC LIMIT 28");
  
  $chartdata = array();
  while($row = $result-&gt;fetch_assoc()) {
         $chartdata[] .= array($row["date"]. ", " . $row["total"]);
      }
  
  $data=array(
    array(
       'label' =&gt; 'Totals',
       'color' =&gt; '#745fa4',
       'data' =&gt; $chartdata
    )
  );
  </code></pre>
  
  <p>If someone could help me out that would be fantastic.</p>