Adding custom columms in table | Peter's Sports League Standings | Forum
Back to the sports standings script page
First, you'll have to edit the sportsdb_wins and sportsdb_teams tables to add the new column. Then, edit admin_files/addscore.php, admin_files/addscoreyes.php, admin_files/editscore.php, and admin_files/updatescore.php to handle the editing of that new column. Points and the display of the column are handled in standings.php.
6:36 pm
hi peter,
The new stat is a snooker break over 50 for a snooker league called halfs.
Ive added the new stat into the database into sportsdb_teams called halfs and sportsdb_wins called homehalf and awayhalf. Ive also managed to get the form fields to save the value for the home team or away team.
Ive also managed to set a if statement for if the value is over 50 but lower than 100 then add 1 to the value in sportsdb_teams and if its over 100 add 2 to the value.
Then i edited standings.php to display the value that was in the halfs column in sportsdb_teams. This displays correctly and i also added the sort option for it.
Now i may sound a bit dumb here. (or its getting late) But i cant seem to work out how i add the value of halfs to amount of points.
Hi,
In standings.php, there are two MySQL queries that involve a line calculating the points:
(teamwins * $points_win + teamforfeits * $points_forfeit + teamties * $points_tie) AS points
Depending on how you award the points, you could tack on something like " + snookerbreak * 1" in those parentheses.
6:37 am
ah... i see.. it must of been late :P
thanks a lot.
My next task now is...
Say i have two new columns. they both work the same way. But i only wanted to display the column if there was a value higher than 0.
I would just use If value >=1 then display column and results etc etc...
Just wondering if i had 2 conferences running but the 2nd conference doesn't require this stat. So all the games played in the 2nd conference will have the stat's value at 0 (as default). Hopefully, the table wont show this column for that conference or will it because in conference 1 there is a value over 0?
Starting to get into stuff now that is a bit advanced for my knowledge and it is starting to confuse my brain at times.
You been great help mate, once i have it all perfect etc etc... i'll make sure there is a link back. plus will show you the final thing to see what mods ive done etc.
The queries run on individual conferences, so you should be OK there. That being said, if you're testing based on the fact that *any* team had a value for that column greater than zero, you'd have to write another query to test for that anyway... and that query would have to limit the results to teams in a particular conference.
6:55 am
I got around the problem by simplifying the added bonus system. So didnt need to do any of the querys (thankfully).
Like said above i would show what i have done. There is a link to your blog on the index page ( i will copy it over to other pages ).
Few things ive added, Renamed conferences and seasons to be more appropiate for my use, Changed teams to players. Changed master teams to game types. Player history is now game type history. Added statistics to show how many leagues, results players etc. ( Working on displaying the last 5 results entered, last 5 players added etc, being a pain though).
You may also notice a few of your other scripts on there! [Image Can Not Be Found]
The CSS needs fixing to cope with IE. So best way is to view the site in Firefox or google chrome. Also have a bug with the admin login at the moment. Seem to get errors when i display the login fields on the site. Works fine if secure.php is on its own.
Just like to say a big thanks peter, Its been a good learning curve for me by following your code. (I hadn’t touched php before i came across this)