title: Count data in same sentence
body: <p>I have table :</p>
  
  <pre><code>==========================================================
  |id | before | after | freq | id_sentence | document_id  |
  ==========================================================
  | 1 |    a   |   b   | 1    |     0       |      1       |
  | 2 |    c   |   d   | 1    |     1       |      1       |
  | 3 |    e   |   f   | 1    |     1       |      1       |
  | 4 |    g   |   h   | 2    |     0       |      2       |
  ==========================================================
  </code></pre>
  
  <p>I want to get the number of data depend on the <code>id_sentence</code> and <code>freq</code> so the result must be 1 2 1
  here's the code : </p>
  
  <pre><code>$query = mysql_query("SELECT freq FROM tb where document_id='$doc_id' ");
      while ($row = mysql_fetch_array($query)) {
          $stem_freq = $row['freq'];
          $total = $total+$stem_freq;
  </code></pre>
  
  <p>but the result is still wrong. please, help me.. thank you :)</p>