
August 7th, 2008, 03:23 PM
|
|
Contributing User
|
|
Join Date: Apr 2007
Location: BC, Canada
Posts: 105
Time spent in forums: 16 h 5 m 21 sec
Reputation Power: 3
|
|
|
[PHP] Best way to handle changing number of variables?
Hey! I'm looking for pointers on a PHP program I'm about to create.
A quick rundown of what the program does:
It simulates a horse show, where the results are dependant on number stats assigned to each unique horse and a random factor.
Step 1: The person running the show inputs the show information and how many horses have been entered into a basic HTML form. The script generates a form with the appropriate number of fields for the horses entered, allowing this person to enter the ID# of each horse.
Step 2: For each horse, the program calls its number stats out of a database, totals them, adds a random factor of (+/-) 0-2. Based on this total, the horse will then be given a random score (where the range of possible scores is dictates by the range the horse's total falls into).
Step 3: The horses are ordered 1st, 2nd, 3rd and so on. This must be printed out for the user to see AND the placement must be made a value to be submitted into a records database.
Step 4: The results are added to the records database.
Now, I'm confident I can do this with while loops, but I'm wondering what the best way to handle Step 4 will be. Suggestions?
|