Page 1 of 1

Next Games

Posted: Thu Jan 25, 2018 9:33 pm
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:

Re: Next Games

Posted: Fri Jan 26, 2018 7:21 am
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.

Re: Next Games

Posted: Fri Jan 26, 2018 11:45 am
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.

Re: Next Games

Posted: Sat Jan 27, 2018 10:27 am
by SimonT
In the STHS code, the query also has "LIMIT 1" at the end. Why didn't work for you?