Jump to content

Archived

This topic is now archived and is closed to further replies.

lpxxfaintxx

Adding Numbers with PHP and MySQL

Recommended Posts

Hello,

I haven't coded in PHP in a long time.. good to be back. I have a question.. I own a game site, www.buzzingames.com. In it, it keeps record of the amount of games played each [i]day[/i]. How do I select the data from them and ADD the numbers up?


[img src=\"http://img.photobucket.com/albums/v216/lpxxfaintxx/phphelp.jpg\" border=\"0\" alt=\"IPB Image\" /]

Regards

Share this post


Link to post
Share on other sites
Hello,

you may use

[code]SELECT SUM(GamesPlayed) FROM gamestoday[/code]

Cheers,
Andi

Share this post


Link to post
Share on other sites
$result = mysql_query("SELECT SUM(GamesPlayed) as total_plays FROM gamestoday");

$row = mysql_fetch_array($result);
echo $row['total_plays'];

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.