Okay I'm building a gaming website and I'm planning on making a little script that has the records. The admin enters the records with a form that looks like this
Opponent:
Map:
Date:
Win/loss/tie:
Scrim/Cal:
I know how to enter this all into a database and everything blah blah but my problem is this.
In my main page http://www.jcartonline.com/xe/ You will see A little Records part that looks like this
Cal - 100-0-0 - .999 - info
Scrim - 100-0-0 - .999 - info
What I can't really figure out is how I'm going to calculate the totals wins and losses for each different one. I'm thinking maybe I should have 2 different tables to seperate them... another problem is how am I going to get the decimal. For those of you who are unware .500 is 1-1 ratio and 1.0 is 1-0 ... so 2-1 would be like .750
Somewhat a project here
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
My question is this:
How do I count the number is wins/losses/ties.
Other question how do I get the ratio of wins to losses in this form .999
I know how the structure is going to look like
1 table for cal
1 table for scrim
each table is going to have these values
date - opponent - outcome (win/loss/tie) - map - competition (cal/scrim)
How do I count the number is wins/losses/ties.
Other question how do I get the ratio of wins to losses in this form .999
I know how the structure is going to look like
1 table for cal
1 table for scrim
each table is going to have these values
date - opponent - outcome (win/loss/tie) - map - competition (cal/scrim)
Last edited by John Cartwright on Wed Feb 04, 2004 3:44 pm, edited 2 times in total.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- johnperkins21
- Forum Contributor
- Posts: 140
- Joined: Mon Oct 27, 2003 4:57 pm
I'm a noob so forgive my response, but wouldn't you just add a column in your db that would update the wins and losses total as they are inserted??
Like
Scrim = win
Cal = loss
Add scrim_wins +1 to database
Add cal_loss +1 to database
Scrim = loss
Cal = win
Add scrim_loss +1 to database
Add cal_loss +1 to database
etc, etc.
If I'm way off, again, I apologize, but this is how I would go about it. I would store as much of the info in the db as possible.
Like
Scrim = win
Cal = loss
Add scrim_wins +1 to database
Add cal_loss +1 to database
Scrim = loss
Cal = win
Add scrim_loss +1 to database
Add cal_loss +1 to database
etc, etc.
If I'm way off, again, I apologize, but this is how I would go about it. I would store as much of the info in the db as possible.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact: