PDA

View Full Version : Alternate Report Generation


chad56s
11-28-2008, 01:29 PM
I've been curious as to how some of the better looking web pages for teams, schedules, rosters, etc. are being generated. The vNFL and FOWL leagues in particular have very nice looking web sites and reports.

Is the utility suite created by gstelmack being used to do this? Is it something else? Is it purely custom?

They're very nice looking and I'm jealous of them.:)

Ben E Lou
11-28-2008, 01:48 PM
Most leagues with custom reports use at least some of the Stelmack tools (mainly Interrogator and DBUpdater) to help create and maintain a database. Php is the most popular language used to code pages to generate the reports from the databases. There is some cross-pollenation and exchange of ideas, but for the most part, the php code is pretty much custom from league to league (with the exception of cases where the same person is maintaining the code and database for multiple leagues).

Php isn't difficult to learn at all with a bit of time and a willingness to dig in and apply yourself. I hadn't coded anything since high school (over 20 years ago), but I picked up a couple of books on PHP, SQL and HTML less than 2 months ago, and have the FOWL and WOOF sites to show for it in that time.

chad56s
12-03-2008, 12:38 PM
Thanks a million for the information. I've been meaning to learn some PHP and mySQL programming anyway.

chad56s
12-14-2008, 09:15 AM
I've successfully set up PHP and MySQL and have populated a database using DBUpdater. Thanks, Ben, for the information on this.

The next hurdle of coure is making use of all of this. One of the first things I tried to do was to generate a basic page containing the standings. However, I don't see any useful tables in the database for doing this.

fof_franchise has just the right columns, but doesn't appear to be updated until the end of the season.

fof_teamschedule can derive the information, but the query is pretty large and messy.

Any tips?

Ben E Lou
12-14-2008, 09:39 AM
I've successfully set up PHP and MySQL and have populated a database using DBUpdater. Thanks, Ben, for the information on this.

The next hurdle of coure is making use of all of this. One of the first things I tried to do was to generate a basic page containing the standings. However, I don't see any useful tables in the database for doing this.

fof_franchise has just the right columns, but doesn't appear to be updated until the end of the season.

fof_teamschedule can derive the information, but the query is pretty large and messy.

Any tips?Your best bet is to do it from fof_teamschedule for the current season. Here's a basic one, run on my IHOF database. (The league is between weeks 4 and 5 of 2019 right now.)

SELECT
cityname,
sum(score>oppscore) AS wins,
sum(oppscore>score) AS losses,
sum(score=oppscore) AS ties,
FROM fof_teamschedule s
JOIN fof_teams t ON t.id = s.teamid
WHERE year=2019 AND week>5 AND week < 23 AND (score>0 OR oppscore>0)
GROUP BY teamid
ORDER BY conference, division, wins DESC, cityname
This returns...

<table border="1" cellpadding="0" cellspacing="1"><tbody> <tr> <th>cityname</th> <th>wins</th> <th>losses</th> <th>ties</th> </tr> <tr> <td>Syracuse</td> <td>4</td> <td>0</td> <td>0</td> </tr> <tr> <td>Boston</td> <td>3</td> <td>1</td> <td>0</td> </tr> <tr> <td>Rochester</td> <td>2</td> <td>2</td> <td>0</td> </tr> <tr> <td>North Plainfield</td> <td>1</td> <td>3</td> <td>0</td> </tr> <tr> <td>Houston</td> <td>3</td> <td>1</td> <td>0</td> </tr> <tr> <td>Fort Worth</td> <td>2</td> <td>2</td> <td>0</td> </tr> <tr> <td>Vicksburg</td> <td>1</td> <td>2</td> <td>0</td> </tr> <tr> <td>San Antonio</td> <td>1</td> <td>3</td> <td>0</td> </tr> <tr> <td>Georgia</td> <td>3</td> <td>1</td> <td>0</td> </tr> <tr> <td>Orlando</td> <td>2</td> <td>2</td> <td>0</td> </tr> <tr> <td>Tucker</td> <td>2</td> <td>2</td> <td>0</td> </tr> <tr> <td>Conyers</td> <td>1</td> <td>3</td> <td>0</td> </tr> <tr> <td>Gothenburg</td> <td>3</td> <td>1</td> <td>0</td> </tr> <tr> <td>Maassluis</td> <td>2</td> <td>2</td> <td>0</td> </tr> <tr> <td>Bordeaux</td> <td>1</td> <td>2</td> <td>0</td> </tr> <tr> <td>Paris</td> <td>1</td> <td>3</td> <td>0</td> </tr> <tr> <td>Minnesota</td> <td>3</td> <td>1</td> <td>0</td> </tr> <tr> <td>Muscatine</td> <td>2</td> <td>2</td> <td>0</td> </tr> <tr> <td>Michigan</td> <td>1</td> <td>2</td> <td>0</td> </tr> <tr> <td>Chicago</td> <td>1</td> <td>3</td> <td>0</td> </tr> <tr> <td>Asheville</td> <td>4</td> <td>0</td> <td>0</td> </tr> <tr> <td>Miami</td> <td>2</td> <td>2</td> <td>0</td> </tr> <tr> <td>Outer Banks</td> <td>2</td> <td>2</td> <td>0</td> </tr> <tr> <td>Knoxville</td> <td>1</td> <td>3</td> <td>0</td> </tr> <tr> <td>Frederick</td> <td>3</td> <td>1</td> <td>0</td> </tr> <tr> <td>Williamsburg</td> <td>3</td> <td>1</td> <td>0</td> </tr> <tr> <td>Chesapeake</td> <td>2</td> <td>2</td> <td>0</td> </tr> <tr> <td>Brooklyn</td> <td>1</td> <td>2</td> <td>0</td> </tr> <tr> <td>Albuquerque</td> <td>2</td> <td>2</td> <td>0</td> </tr> <tr> <td>Oakland</td> <td>2</td> <td>2</td> <td>0</td> </tr> <tr> <td>Boulder</td> <td>1</td> <td>3</td> <td>0</td> </tr> <tr> <td>Fairbanks</td> <td>0</td> <td>4</td> <td>0</td> </tr></tbody></table>
Note that I'm excluding games in which both teams don't score. It's the easiest way I could think of to keep all the unplayed games in a season from showing up as ties. You *could* pull the current stage from fof_gameinfo and compare it. That's more clean, but it's also more work. As long as there are no scoreless ties (and I've never seen one in any of my SP or MP leagues), this way of doing it works just fine. ;)

With a bit of formatting and the addition of some more stuff to the query, you can eventually get the following data all from that table:

STANDINGS (http://www.younglifenorthdekalb.com/woof/ben/standings.php)

jdavidbakr
12-14-2008, 09:18 PM
I had been using non-zero attendance to determine whether a game had been played, until the AUFL had some teams who have had 0 attendance this season. Now I exclude games with 0 attendance and 0 scores.

Ben E Lou
12-15-2008, 02:38 AM
...until the AUFL had some teams who have had 0 attendance this season...:lol:

chad56s
12-15-2008, 10:01 AM
Wow, that's great! I didn't realize you could do a sum on a comparison like that. That simplifies things immensely.

Thanks for the help!

Ben E Lou
12-15-2008, 10:03 AM
I didn't either until I just tried it out. ;)

Seriously, so far every time I've had the thought "I wonder if it will let me...," it has let me. There have been times that I've had to go to the interwebs or to FOFCers for help with syntax, but in terms of flexibility, this stuff is the bizomb to me.