Hi all,
I am trying to (I think this is possible) add together the numeric values of one field in all rows, and gain the total amount.
I have used:
$query = "SELECT SUM(seats) as how_many,seats FROM $sqlbookings GROUP BY seats";
$list_seats = mysql_query($query) or die(mysql_error());
mysql_close();
while ($row = mysql_fetch_assoc($list_seats)) {
echo $row['how_many'];
}
For example, let's assume I have 3 rows, 1 has the value of 100, 1 has the value of 50, and 1 has the value of 5. The total should be 155. However, the above echoes out: 100505 - it is putting together the amounts, as opposed to adding them up.
Is there a way I can work around this?