title: PHP, mySql Select all with the same name
body: <p>So I have a table where some of the products repeat with but have a different value on number of clicks.</p>
  
  <pre><code>name ----  clicks
  iPhone       4
  Samsung      2
  iPhone       1
  Samsung      5
  </code></pre>
  
  <p>my select function is :</p>
  
  <pre><code>$select_table2 = 'SELECT * FROM `mytable`'; //WHERE NAME IS THE SAME
  $sql2 = $db-&gt;query($select_table2);
  while ($row = mysqli_fetch_array($sql2)) {
   echo $row["name"];
   echo $row["clicks"];
  }
  </code></pre>
  
  <p>I need this output:</p>
  
  <pre><code>iPhone       5
  Samsung      7
  </code></pre>
  
  <p>I don't want to merge the same rows because they have one more column that is different. So please do not suggest simply to merge them and update the clicks...</p>
  
  <p>UPDATE:</p>
  
  <pre><code>$pull_request = 'SELECT SUM(e.product_clicks),e.product_id, u.name, u.product_id FROM `oc_aa_affiliatecollclicktracking` AS e GROUP BY e.product_id  LEFT JOIN  `'.DB_PREFIX.'product_description` AS u ON e.product_id = u.product_id';
  </code></pre>
  
  <p>I tried it like this but it's not working</p>