MySQL/PHP Question
Moderator: General Moderators
MySQL/PHP Question
ok say that i have a column in my table that has a list of download counts, how would i make a php/mysql query to count up all the numbers for each row into 1 full number aka the total download count?
It depends if you just want to know how many records :
or if you have values on each record that you want to total up :
then add on your WHERE clause to limit it to the specific details you want or leave it off for all the records.
Code: Select all
SELECT COUNT(*) FROM table_name WHERE ....Code: Select all
SELECT SUM(*) FROM table_name WHERE ....If you read these two tutorials I am sure you will find out that there are many other things you can do with mySQL that could simplify your life in the future.
http://www.devshed.com/Server_Side/MySQL/Speak/
http://www.devshed.com/Server_Side/MySQL/Speak/