Jump to content

how to count number within a DB field


hossfly007

Recommended Posts

I am trying to count how much money a person has won and i cant find the right forumula for it.

 

Here's an example:

 

TABLE_MONEY

>>ID

>>DATE

>>NAME

>>MONEY_WON

 

ID DATE NAME MONEY_WON

1 4/1 Jon 50.00

2 4/1 Tim 20.00

3 4/2 Jon 10.00

4 4/2 Tm 15.00

 

could someone show me a code that would tell me how much money Jon and Tim made? or a link to an example (if it's to complex)

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/45895-how-to-count-number-within-a-db-field/
Share on other sites

ok one more thing, hate to be a newb again, but i cant get it to work... please help one more time

 

 

$query = "SELECT SUM(money_total) as cash FROM TABLE_MONEY WHERE NAME IN('Jon')";
$r1 = mysql_fetch_array($query);
$stats['cash'] = $r1['cash'];
$text .= "{$stats['cash']}";
}

Archived

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

×
×
  • Create New...

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.