title: How to create pie chart using PHP and MYSQL?
body: <p>I have a table which shows my data and it works perfectly. I need to add in a pie chart also to show the exact same data that was shown on the table.</p>
  
  <pre><code> &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;Account Type&lt;/th&gt;
                      &lt;th&gt;Account Number&lt;/th&gt;
                      &lt;th&gt;Account Balance&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
                  &lt;?php
                  $query = "SELECT * FROM account WHERE user_id='$user_id'";
                  $result = mysqli_query($link, $query) or die(mysqli_error($link));
                  while ($row = mysqli_fetch_array($result)) {
                      $acc_type = $row ['account_type'];
                      $acc_num = $row ['account_number'];  
                      $acc_bal = $row ['account_balance']; 
  
                      ?&gt;
                  &lt;tbody&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;?php echo $acc_type ?&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;?php echo $acc_num ?&gt;&lt;/td&gt;
                          &lt;td&gt;$ &lt;?php echo $acc_bal ?&gt;&lt;/td&gt;
                      &lt;?php
                  }
                  ?&gt; 
                      &lt;/tr&gt;
              &lt;/tbody&gt;  
              &lt;tr class="alt"&gt;
                  &lt;?php 
                  $query = "SELECT SUM(account_balance) AS account_total FROM account WHERE user_id='$user_id'";
                  $result = mysqli_query($link, $query) or die(mysqli_error($link));
                  while ($row = mysqli_fetch_array($result)){
                      $acc_total = $row ['account_total'];
                  ?&gt;
                  &lt;td colspan="2" align="right"&gt;&lt;b&gt;Total: &lt;/b&gt;&lt;/td&gt;
                  &lt;td align="right"&gt;&lt;b&gt;$ &lt;?php echo $acc_total ?&gt; &lt;/b&gt;&lt;/td&gt;
                  &lt;?php
                  }
                  ?&gt;
              &lt;/tr&gt;
  </code></pre>