Jump to content

help with adding colum data


sandrob57

Recommended Posts

Ill give you a scenario so you can understand what I am trying to do.

 

Lets say I run a website, and on it you can have clubs. Each club members competes and earns points.

 

I want to be able to select all the users from a certain club, and add their points cumulatively.

 

So, if my database looked like this:

 

ID Club Score

1fire14

2fire2

3ice8

4fire3

 

So, if I wanted the score of team fire, it would be 19.

 

How do I get this in a variable??!

 

I got to this so far, but it does not work:

 

$a_ai = dbquery("SELECT SUM(score_field) FROM user_table WHERE team='".$team."'");

 

Help!

Link to comment
https://forums.phpfreaks.com/topic/39874-help-with-adding-colum-data/
Share on other sites

I get "Resource id #37" as the variable output

 

And, this is what it actually looks like. It is counting up the artificial intelligence of an alliance:

 

c_ai is colony ai

 

$a_ai = dbquery("SELECT SUM(c_ai) FROM fusion_users WHERE c_alliance='$a_choice'");

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.