title: Sum of MYSQL Query
body: <p>I have a MySQL DB</p>
  
  <p>I would like to get the sum or totals of values in my columns I need to echo it to be used in Google Graphs</p>
  
  <p>This is my current code</p>
  
  <pre><code> &lt;?php 
          $query = "SELECT * from activation";
  
           $exec = mysqli_query($con,$query);
           while($row = mysqli_fetch_array($exec)){
  
           echo "['".$row['type']."',".$sum['type']."],"; 
           }
           ?&gt; 
  </code></pre>
  
  <p>The row Type is the ones I want to get SUM on their values differ from HIJACKING ACCIDENT and so forth values are constant. </p>
  
  <p>The $sum I know is wrong but this is where I need to echo the totals of row type</p>
  
  <p>The following code worked </p>
  
  <pre><code> &lt;?php 
              $query = "SELECT type, count(type) from activation group by type";
  
               $exec = mysqli_query($con,$query);
               while($row = mysqli_fetch_array($exec)){
  
               echo "['".$row['type']."',".$row['count(type)']."],";
               }
               ?&gt; 
  </code></pre>