I’m working on a lottery system for my game and i’m having issues with the total pot size
current progress: http://playsilab.com/lottery
Anyways, what i’m doing is having it so a user will buy a ticket in the game and that will count as +5 currency to the pot.
This is what the table looks like

basically i need it to count all those 5000000’s and output 1 number
or my other idea, get the amount of people and *5
any of those would be great 🙂
basically for 8 people with 5000000, it should print out 40000000 (40M)
my attempt:
$pot = mysql_query("SELECT name, SUM(pot), COUNT(name) FROM contestants");
$details = mysql_fetch_array($pot);
$totalpot = $details['SUM($details['pot']'];
This line is wrong:
The problem seems to be a combination of:
Give your columns aliases so that it is easier to refer to them in your source code:
Then you can just write:
Also there are a number of other problems with your code, for example:
namefrom a single row and an aggregated value like aSUMin the same result set. In MySQL it is legal, but in many other databases this would be rejected as an error.