Comments prior to April 12, 2008 for Peter’s Sports League Standings

All comments are now made in the forums. The comments here are for archival purposes.

Back to Peter’s Sports League Standings


54 Responses to “Comments prior to April 12, 2008 for Peter’s Sports League Standings”

  1. Mark Delleman says:

    Hey, I was hoping you could add Runs Scored and Runs against in the code somehow. I am just learning PHP so I have fiddled with your code a bit to work for me. I keep track of a church slo pitch league. There are alot of things I can learn form your code so I thank you. Let me know if this is possible.


  2. Mark Delleman says:

    Oh and also if you could add Games Played that would be a cool addition as well.

  3. Peter says:

    Yes, that is possible. Unfortunately, I’m going on vacation for a month, so I can’t do anything on the script until mid-June.

  4. Mark Delleman says:

    Hey, I have added all the code myself, GP, RF, RA. Learned alot from your code. Thank you very much. If you would like me to send you what I did let me know.


  5. Jason says:

    I started testing this software recently and really like it. The addition of divisions was very important to me. I’m hoping it can replace my copy of Nuke League running on my site.

  6. Peter says:

    I’m back from my vacation and am working on a custom implementation for a baseball league. Features from that, such as a GP column and a games behind calculation, will soon make their way into the public release.

    Because the script is intended to be basic (thus needing some customization for most, if not all implementations), I’d love to see a bunch of branches off the base release catered to different sports.

    I guess we’ll take it one day at a time! The day job always gets in the way, of course…

  7. Mike Fitz says:

    Could you or Mark Delleman please post the code that Mark added?

  8. Peter says:

    Maybe Mark can post what he did. The project I’m working on is *still* ongoing, so I can’t just put up a snippet as there’s a bit of an overhaul…

  9. Mike Fitz says:

    Thanks Peter.
    Do you have an est. completion time? I know this is not you day job — just curious.

    thanks for you effort.

  10. Peter says:

    I’m guessing within the next two weeks…

  11. Jason says:

    Can’t wait. I’m really looking forward to it. Thanks.

  12. Peter says:

    Version 0.4 is now finished. I need to do a bit more testing and hope to release it sometime this week.

  13. Peter says:

    Version 0.4 released!

  14. Jason says:

    Excellent. Thanks for the hard work. Looking forward to installing the new version.

  15. Jason says:

    Divisions can only be added the conference 1 through the admin panel.

  16. Peter says:

    Fixed and updated in the download. Thanks for pointing that out!

  17. Jason says:

    Thank you for the update and a great product. The new conference addition actually allows me to run a few simultaneous leagues at one time.

  18. Mitja says:

    Hi Peter. Keep up the good work. I am running a static side for my icehockey/inline team. It’s a beer league consisting of two :) teams but with great rivalry :). I am updating the simple stats manually which can be a real pain in the ass sometimes, so I am thinking of putting a PHP site/portal or insert a piece of php in the existing site. I am a newbie in PHP, but technically I know how things (PHP and MYSQL) work. So I wonder if it would be very hard and time consuming if you incorporated a script (form) where you could first enter the names of the players, then a form through which you would be able to update goals and assists, which would be shown in the three tables. Separate stats for the players of each team, and a common one. I like your product because it’s simple and compact and I don’t want too much additional options. I am not skilled enough too make it myself, so I would be very glad if you could help me or at least give me some directions. Thanks in advance

  19. Peter says:

    Hi Mitja,

    Unfortunately I cannot dedicate the time right now to any new projects. From what you are describing, if you were to use my standings script, you would need to add another database table — one with these fields: player ID, player first name, player last name, player team ID (linking to the teams table), goals, and assists. Points would be calculated via PHP when displaying stats. Then, yes you would need a script to add, edit, and delete players, one that adds an extra form to when adding, editing, and deleting a game, and then two for display: one that lists all the players on a team and one that lists all players in the league.

    That is the simplest setup. However, suppose that a player current has 1 goal and 1 assist after 3 games. In the next game, he or she scores 2 goals. When you go to update that player, you simply update the total goals. You have no record of the count of goals or assists he or she had for each game. Therefore, this is prone to human error unless you’re very very careful. What you would need is a third database table: one with these fields: game ID, player ID, goals, assists. Then whenever you update a game, a script would add one entry per player per game. Total goals and assists per player are then tallied from this.

    I hope that maybe someone else can contribute by adding this “plugin”? If so, please let me know.

  20. Mitja says:

    Thanks a lot for the tips and to everybody who would sacrifice their time for trying to design such project. If I succeed, or come close to the solution I’ll let you guys know.

  21. David says:

    Great Work and really enjoy using this software.

    I have a suggestion for something to add on the next verison. And that would be to have the schedule where you can click on a team name and just bring up their scheduled games only.

    I run a City Adult Softball League Website and they like it where they can print out just their own team schedule and this would be a great asset if you could figure out how to add it to the code.

    Here is a link to our website so you can see what I am talking about

    Again Thanks for the Great Work!!

  22. Peter says:

    Hi David. Thanks for the suggestion. I’ve just released version 0.5, where the main new feature is the ability to filter the schedule and scores by team.

  23. Jason says:

    Thanks again for the update!!!

  24. ilcastro says:

    Hi Peter, I love your script. It’s very usefull.

    I like to suggest to add an option to generate automatic fixtures. I have a division with 10 teams and I must enter the matches one by one. I think that it would be very useful if the script could do the trick automatically.

    thanks for this fantastic work

  25. raul says:

    The software is in spanish? or not?

  26. Mark says:

    Very cool software.
    I put some teams in but can’t seem to delete them from the division. I did make them inactive but theres nothing to click on to delete them. So how do I delete them ?

    Also what does the secure.php do ?


  27. Peter says:

    Hi Mark,

    secure.php provides the password protection for the admin interface.

    Unfortunately, the only way to delete a team is to remove its entry from the sportsdb_teams table. That, or simply rename an inactive team whenever you need to add a new team. I added this restriction so that you couldn’t delete teams that were already part of a past score or upcoming game (thus preserving any references to that team).

    However, for the next version (whenever that is) I should add the delete team feature, but with a check that prevents you from deleting a team that are part of a past score or upcoming game. In such cases, you have to first delete any past scores or upcoming games involving the team before you can delete that team.

  28. Mark says:

    Thanks. That worked.
    I am trying to put a banner at the top of the page
    but can’t get it to show. It blows out the page.
    Is this possible ?
    Thanks again.

  29. Peter says:

    Yes, you should be able to modify anything on the page. In fact, you can strip out all of the surrounding html stuff and insert the standings code into an existing page design.

    I’m not sure what you mean by “blow out the page”. I’m guessing that you just have to tweak nesting or order of tags somewhere in your code.

  30. Jason says:

    I was able to add my sites logo/banner to the top of the page:

    I added this code right under the tag in index.php:

    Peter, looking forward to the next version.

  31. Mark says:

    Yes I had something wrong cuz I got a error about unexpected something. (sorry can’t recall).

    Jason thats nice. What did you do to get the games and schedule to come out like that. I like that alot.
    I am not a good hacker at all.

  32. Mark says:

    Parse error: syntax error, unexpected ‘<‘ in C:\Domains\\wwwroot\softball\standings\index.php on line 56

    is what i get most of the time when I edit the index.php.
    don’t know enough about php really.


  33. Peter says:

    Hi Mark,

    If you want to add HTML code to a PHP file, the simplest methods are to use the print function or close the PHP block, print the HTML, and open it again:

    php code goes here;
    <img src='blah.jpg' alt='Blah' />
    more php code goes here;

    Also, most of the standings and schedule stuff on Jason’s page is default functionality.

  34. Jason says:


    The form must have filtered out some of my reply. I entered the following code right after the <body> tag:

    <p align="center">
    <img src="your_logo.jpg" alt="My Web Site Name" align="center"
    <hr />

    As Peter mentioned, my site hardly has any changes made to it. I just changes the position of the home and away teams and added horizontal lines between each section using the command.

    Hope this helps.

  35. Jason says:


    Is there a way to have the Past Scores sorted so that the most current games are at the top instead of the bottom? Thanks.

  36. Peter says:

    Hi Jason,

    Find this line:

    $queryscores .= " ORDER BY wintime ASC";

    Replace it with:

    $queryscores .= " ORDER BY wintime DESC";

    I'll make this the default for the next version (that could be next week or in three months).

  37. Jason says:

    Thank you Peter.

  38. trey says:

    peter is this something that can be dropped in flash… i am looking to incorporate a flash standings within my flash movieclip…


  39. Peter says:

    Hi Trey, someone more experienced with Flash would have to answer that. The standings output is a rather simple grab from the database, but I have very little experience with Flash. You or someone else can certainly hack away at my standings code of course!

  40. Shades says:

    First of all what a great script.

    Just a couple of like to haves for the next version if possible.
    1.Is it possible to have multiple logins so that users can only administer their own conference/league.
    2. Different points for home/away game wins.
    3. Different points structure for each conference/league.
    4. Ability to add bonus points to the total i.e. an extra point for each 'For' scored.

    Great stuff !!

  41. Keith says:

    neat script! how do I import a part of the standings page to put the data on the front page of my site?

  42. Dave says:

    This was easy to install. I have little knowledge of php or Mysql but was able to figure out how to load and get it up and running.

    Using a Css file, I easily integrated it into my website. I did some formating on the table to change the look and centre the data

    I plan to use it for a girls ball hockey site. I tested in on the 2007 data here

    And have my 2008 season ready to go already

    One workaround I used, was to use divisions to seperate Exhibition, Regular season and playoffs. I could have made these different conferences but I wanted to scho the complete schedule on one page. The software would allow you to duplicate the team names in different conferences but that makes it difficult to use the team filters for past and upcoming games. therefore, I differentiated the team names by add "Ex" for Exhibition games

    Thanks this was very helpful and has me intersted in learning so I can write something for my Ice Hockey team. I currently track it all in excel and manually update Team and player stats

  43. Peter says:

    Keith: Unfortunately, the best way to go about it right now is to just hack out the parts you need from standings.php. The standings table ends before the header for "Past Scores".

    Dave: Nice examples! I'll have to figure the ability to have multiple seasons into the long-term plans for the script.

  44. Jason says:

    Nice site Dave.

  45. Susan says:

    I am just learning PHP and found your sample. This is very helpful to me. Thanks so much for posting. Much appreciated!

  46. Gil says:

    Nice work Peter. Have you ever thought about adding an automatic fixture option? I mean once you have enter the all the teams it would go out and generate the games for you.

    Again great work. I am going to try to incorporate this into a youth soccer league

  47. Peter says:

    You mean a schedule generator? Yes, that would be cool, but would be on the long-term wish list unless other people want to help code!

  48. Jason says:


    I added fixed sized table columns to the standings for better alignment. I can send you the code if interested. You can view what it looks like here:

  49. Peter says:

    Hi Shades,

    Sorry for the slow reply, but for some reason my blog has been erroneously labelling a lot of comments as spam. Anyway, to go through your suggestions:

    1.Is it possible to have multiple logins so that users can only administer their own conference/league.

    – Happily, this was implemented in Version 1.0 :D

    2. Different points for home/away game wins.
    3. Different points structure for each conference/league.
    4. Ability to add bonus points to the total i.e. an extra point for each 'For' scored.

    – Probably not high on my list, but noted.

    Thanks for the feedback!

  50. Mike says:

    Absolutely love this app! Has made managing multiple divisions, and league scores easy.

    Take a look:


  51. Peter says:

    Jason — thanks for the example. What I should really do is make the script’s style as modifiable as possible. I will be sure to work with you when I start on the next version (no timeline yet).

    Mike — wow, what can I say, that is really slick! Now I just need some time to push forward on the project!

  52. Shades says:

    Many thanks for your excellent work…

    Gil asked for a fixture generator to be included.

    I have coded a fixture generator and can send you the code if you wish, but have not worked out how to integrate it into your script.

    Your script has certainly made our task of league management a lot easier.

    Many thanks.. :)

  53. Jason says:


    Forget about my layout, I’d use Mike’s at as a guideline.

    That looks fantastic!!!

  54. Brendan says:

    I love the script. We’ve been using it to track standings for an ultimate frisbee league for two seasons now. Everyone really likes it.

    One thing that’s been requested is having a little more logic in sorting. It would be so cool if I could set it to sort by Points, and in the case there were two or more teams with the same number of points, those teams could be sub-sorted by Runs For or some other column.