Arrow

remove conference | Peter's Sports League Standings | Forum

Back to the sports standings script page

Please consider registering
guest

Log In

Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

   

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
remove conference
June 25, 2008
5:19 pm
Jay
Guest

I do not have a reason for conferences. I am running a youth soccer website and the League Standings are awesome. Since I have 40 divisions, I manually added division names as conferences and divisions directly through mysql to save time. How can I remove the use of conferences, only using divisions?

June 25, 2008
5:59 pm
Peter
Admin
Forum Posts: 841
Offline

Hi Jay,

Structurally (db-wise) you would keep things the same.

On the admin side of things, you could add some MySQL code that adds a division whenever a conference is added (under case 'add': in the management script). This is quite similar to what you've already done, but will help to automate things in the future.

On the display side of things, you would just have to treat conferences as divisions. In other words, the index page would still list the conferences, but you would just change it to say that it lists divisions. Then, since each conference of yours contains exactly one division, make the conference view look like a division view (remove the conference title and make the division name print the conference name instead).

June 25, 2008
8:09 pm
Jay
Guest

Thanks a lot!

Wouldn't I have to script more than just the case 'add'? What about:
case 'conferences'?
case 'editconferences'?
case 'deleteconferences'?

June 25, 2008
8:18 pm
Peter
Admin
Forum Posts: 841
Offline

Yes, the optimal way to do it would be to take care of those views as well. If you are the only admin, then it's not that much of a hassle since you can just remember to edit a division and conference in the same task, which is probably a rare occurrence. If you want to go all out, keep these things in mind:

- You should remove the "add / edit / delete" division functionality.
- The delete conference functionality only operates if the conference has no divisions or teams, so you'd have to remove the division check while you're at it.

June 26, 2008
9:09 am
Jay
Guest

Thanks a lot Peter.

As a notch just above noob, I thought I was making progress but am not. I tried adding to INSERT, but I think I am doing it wrong because it did not work. Or, I am not declaring variables.
$query = "INSERT INTO ".$db_prefix."sportsdb_conferences (confname,conforder) VALUES ('$confname','$conforder') AND ".$db_prefix."sportsdb_divs (divname,divorder) VALUES ('$divname','$divorder')";

I feel dumb!

June 26, 2008
11:29 am
Peter
Admin
Forum Posts: 841
Offline

First of all, I should correct what I said earlier: it should be case 'editconferences' (which handles adding and editing conferences), not case 'add' :D

Anyway, you'll need two separate statements to add the conference and the division. Then you'll need a statement in between to get the conference ID that you just added so that it can be the parent of the division.

It should look something like this (although I haven't tested it):

// Insert the conference as usual
$query = "INSERT INTO sportsdb_conferences (confname,conforder) VALUES ('$confname','$conforder')";
mysql_query($query) or die ("Error in query $query");

// Get the conference ID
$conference_inserted_id = mysql_insert_id();

// Insert the division
$query = "INSERT INTO sportsdb_divs (divname, conference) VALUES ('$confname', '$conference_inserted_id')";
mysql_query($query) or die ("Error in query $query");