Ok, so let me introduce what I'm doing so you may better understand my problem. I may be going about things the wrong way.
I'm wanting to run a sports website using MySQL and PHP. I want to be able to enter a master schedule with scores into the database and then use that master schedule and list of scores to generate individual pages for each school in the coverage area. I plan on setting up tables for each sport (football2011, volleyball2011, etc., for example). So I have no problem returning the data that I enter. The problems that I have are two-fold.
Here are the two "test" files I'm using:
ohioprimetime.com/test.php (Master schedule and results)
ohioprimetime.com/zanesville.php (School schedule and results)
1. How do I display the result? I can't enter win or loss into the master schedule (or can I and not display it?). At any rate, I currently have a bunch of IF statements that will display the results. So here are some notable variables:
So to create a "Win" or "Loss" result, here is my statement (Zanesville is the "dummy school" I'm using for this example):
<?php if ($f4=="Zanesville" && $f5>$f7) echo "Win"; if ($f4=="Zanesville" && $f7>$f5) echo "Loss"; if ($f6=="Zanesville" && $f7>$f5) echo "Win"; if ($f6=="Zanesville" && $f5>$f7) echo "Loss"; ?>
Is there another way I should look at doing this?
2. My second problem is I'd like to have the win-loss record updated automatically after each game. I figure I need to use a loop, but I'm not sure on this. I also don't have any experience in using a loop. I'm in a class learning how loops work but they've been simple loops thus far, I'm thinking this is a bit more complicated.
Any advice here is appreciated.
I can provide more code if needed.
For #2, if I'm wanting to use that win-loss data for a standings file, should I create a table containing that information separately?
Last edited by deepsand; 10-09-2011 at 12:51 AM.
Reason: merged consecutive & related posts