title: Query result shows unwanted SQL SUM formula text in PHP/HTML display
body: <p>I have a table 'marks' with fields Q1mark, Q2mark, Q3mark . . . Q50mark corresponding to the 50 questions in an exam. </p>
  
  <p>I want to display how many marks each question attracted, and I'd like to order the questions by difficulty. </p>
  
  <p>So I loop through 50 and put the key=>value pairs in a HTML table:</p>
  
  <pre><code>for ($i=1; $i&lt;=50; $i++)
   {
  
          $stmt = $db-&gt;prepare("SELECT (SUM(Q".$i."mark)) FROM marks");
          $stmt-&gt;execute();
          $results = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);
  
        foreach ($results as $result) 
            { 
              echo '&lt;tr&gt;';
              foreach ($result as $key=&gt;$value)
                    { 
                  echo '&lt;td&gt;'; echo $key; echo '&lt;/td&gt;';
                  echo '&lt;td&gt;'; echo $value; echo '&lt;/td&gt;';
  
                } 
          echo '&lt;/tr&gt;';
                }   
      }
  </code></pre>
  
  <p>What I get is:</p>
  
  <pre><code>------------------------
  | (SUM(Q1mark)) |   18 |
  | (SUM(Q2mark)) |   20 |
  | (SUM(Q3mark)) |   8  |
  | (SUM(Q4mark)) |   12 |
  ------------------------
  </code></pre>
  
  <p>but <strong>what I want</strong> is:</p>
  
  <pre><code>----------------
  | Q3mark |  8  |
  | Q4mark |  12 |
  | Q1mark |  18 |
  | Q2mark |  20 |
  ----------------
  </code></pre>
  
  <p>How do I get rid of the displayed formula text?, And order the data by difficulty?</p>