You are putting too much thought into this. Don't get reporting mixed up
with computing. When your admin updates the games and designates who won the
game, put a 1 in a column next to the winning team and a 0 next to the
looser, if they tie, enter a 1 next to both teams. Then when you want to see
a list of who got the most right that week, make a query that matches the
choice the player made with the team they chose and count it if there is a 1
in this new column. Most of your work is going to be in writing queries that
bring back the right totals. If you try to write a routine to add values to
a 'total' column if a given team wins, it just might work. But what if you
accidently runit twice or forget to run it. Your results will not be
You also asked about locking people out after a given time. This is very
easy, when they fill out a form to pick winners, that form has to be
submitted to a PHP script for processing, this is where you check to see if
the cut-off time has passed. If so, then you display a message telling them
that they are too late and do not accept the entries. 

Bottom line is leave the calculations to the report (web page) and the data
to the database.

Jim Hunter
-------Original Message-------
From: JeRRy
Date: Tuesday, March 11, 2003 17:23:47
Subject: [PHP-DB] some php and database questions!

I am currently running a tipping competition where
people tip the team they think will win the given game
or pick the draw. Each correct entry gets +1 point,
each incorrect entry gets 0 points. There is 8 games
a round and people submit their entries via a PHP page
that updates a mysql database. Now for the admin side
of things, to make it easier for admins to update
records accordingly without needing to manually add
them up one by one.

I want a system I can go into where I select the
winners of each round. If a tipster has any matches
it will credit their accounts +1 for each correct
entry and 0 for each incorrect entry. There is 8
games a round (on a weekend) .. So how would I get
the entries to update to the correct amount when I
select the winners.

I'd need the admin page to be something like this.

Game1 : team 1
team 2

Game2 : team 3
team 4

and so on, Probably a drop down menu to select the
winner or draw. So what query would I need or PHP
code to update the database with +1 for correct
matches and 0 for incorrect? Or would I be better to
have 1 page per game? I need a safe and reliable way
of doing it.

Also I am going to have a tipster tally. They will be
in order of total score. So order will change from
week to week, how can I auto-sort a list using PHP to
display on a page without it messing up the score with
someone else. So I need the top score to go to the
top but take the name also and not just the score, any

For instance:

Week 1

bob 7
judy 6 
Amanda 5

Week 2

Judy 10
Amanda 9
bob 8

From week 1 to 2 bob needs to drop down the bottom,
Judy needs to move up one and Amanda is to also move
up one. I need it to be automatic instead of me
having to do it manually. Any ideas? (I think this
was discussed about a month ago, if so I appologise
for the repeat but the help is very appreciated.)

Lastly the games in the week are different from
others. There is normally a Friday night games, a few
Saturday games and Saturday Night and a few Sunday
games. I really don't want to lock people out if they
don't submit a tip before the first game. But I do
want to lock out any tips made for a game that has
already started. 

For instance:

It's 8:05 PM and there was a game to start at 7PM I
want to lock out the tips for the first game but allow
tips for the remaining games. How can I lock people
out? Sure I could remove the option on the page but
that does not stop people from loading the page just
before the start of the game and sitting on it till
the game has finished and than submitting their tips. 
I need another way, dynamic pages? Or something else?
If the easiest option is to lock people right out
after the first game has started I will, but I'd
prefer to not do that.

Feel free to use any database structure you like, any
table names are ok. As long as you define what you
mean so I can understand what you mean and I can try
for myself.

Thanks so much in advance, credit will be given.

Jerry - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.

PHP Database Mailing List (
To unsubscribe, visit:


Reply via email to