With this query
$query12 = "SELECT * FROM value LEFT JOIN horsevalue ON horsevalue.value_id = value.id WHERE horsevalue.horse_id = $horse_id AND horsevalue.value_id = ".$row['id']." GROUP BY value";
$result12 = mysql_query($query12) or die(mysql_error());
while($row12 = mysql_fetch_array($result12)){
$total = $row12['value'];
echo $total;
}
I get this result
10000000003005002005005003004008008001000200400500200100010002000
But what I want is
10,700
which would be the total of all the numbers in the array.
What am I doing wrong? I guess the whole query is just wrong.