Next Games

Any questions related to version 2 or version 3 should be ask here. / Toutes les questions sur la version 2 ou la version 3 devraient être demandées ici.
Post Reply
gorbs27
New in Town / Le Ptit Nouveau
Posts: 8
Joined: Mon Jan 26, 2015 10:12 am

Next Games

Post by gorbs27 »

I'm having an issue with the Next Games line in the pro and farm team headers.

http://www.nsimhl.com/ProTeam.php?Team=3

Below is code from ProTeam.php. I changed the "ORDER BY GameNumber LIMIT 1" to "ORDER BY Play LIMIT 1" for the next game.

$Query = "SELECT * FROM SchedulePro WHERE (VisitorTeam = " . $Team . " OR HomeTeam = " . $Team . ") ORDER BY Play LIMIT 1";
$ScheduleNext = $db->querySingle($Query,true);

In my tests everything works out just fine. When I uploaded today, it appears to only be showing the team's next road game.

I need help! :lol:
SimonT
STHS Owner / Propriétaire du STHS
Posts: 14755
Joined: Sat Oct 08, 2005 4:18 pm
Location: Montreal, Canada
Contact:

Re: Next Games

Post by SimonT »

Why do you want to order by Play? It doesn't make sense to me. The Play is True or False and not a good variable to order by.
-SimonT
Forum Administrator / Administrateur du Forum
STHS Owner / Propriètaire du STHS
English V2 & V3 Manual - Manuel V2 & V3 Français
gorbs27
New in Town / Le Ptit Nouveau
Posts: 8
Joined: Mon Jan 26, 2015 10:12 am

Re: Next Games

Post by gorbs27 »

You are correct regarding the order by play. I shouldn't have done that, but the answer wasn't coming to me yesterday so I tried it and it was working in my test file.

I had to change the code to correctly show the team's next game because as written it will display each team's first game as their next game.

This morning I added the following to the code: AND Play = 'False' so the query string looks like this:

$Query = "SELECT * FROM SchedulePro WHERE (VisitorTeam = " . $Team . " OR HomeTeam = " . $Team . ") AND Play = 'False' ORDER BY GameNumber";
$ScheduleNext = $db->querySingle($Query,true);

This appears to have fixed the issue, as the team's next game is displayed correctly.
SimonT
STHS Owner / Propriétaire du STHS
Posts: 14755
Joined: Sat Oct 08, 2005 4:18 pm
Location: Montreal, Canada
Contact:

Re: Next Games

Post by SimonT »

In the STHS code, the query also has "LIMIT 1" at the end. Why didn't work for you?
-SimonT
Forum Administrator / Administrateur du Forum
STHS Owner / Propriètaire du STHS
English V2 & V3 Manual - Manuel V2 & V3 Français
Post Reply