how to sum each column in mysql with php? : <p>I'm trying to sum all the columns from a table but its not working.
This is my query to the DB: </p>

<pre><code>$sql = mysql_query("SELECT SUM(clicks) as total FROM urls WHERE member_id='$mem_id'");
$row = mysql_fetch_array($sql);
$sum = $row['total'];
</code></pre>

<p>When I try to run the script nothing is working. I tried also with while loop and I get all the results from column clicks on a new line and I cannot sum them.
Where I am doing a mistake ?</p>
