Jump to content

Jim R

Members
  • Content Count

    637
  • Joined

  • Last visited

  • Days Won

    1

Jim R last won the day on July 26 2018

Jim R had the most liked content!

Community Reputation

1 Neutral

About Jim R

  • Rank
    Prolific Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Got it...I missed that you added gamedate to the top part of the query.
  2. It doesn't appear $prevdate is keeping any values. I put... echo $prevdate . ' ' . $today; ...in the loop, and all it prints is $today each time. UPDATE: I gave it a value to start, 1980-01-01, and it just prints that date next to today's date.
  3. I didn't necessarily know how to do that... ...and I agree the fixture dates would be a good indicator. We're talking basketball here. No draws. What you tried didn't work, but I see the trigger you defined. (I've done this on a previous project, and even look at it for reference. I couldn't for the life of me get my head around. https://www.courtsideindiana.com/season-preview/19-20/sectional1920/?sectional=8 In the Carmel example (first one), the first two dates are set for 2018. The final two dates are set up for 2020.
  4. This is an aesthetic issue. As the season progresses, there will be games which have been played and upcoming games. Having added a *winner* column to the games table (a_games1920), I figured that's a good trigger to determine games played vs. upcoming games. I'd like there to be a separation between those blocks of games (past vs. future). I have tried various ways (none of which are reflected in the code below), and I can't wrap my head around how to trigger the separation just once. I'm assuming I'd be printing </table> <table> somewhere to end the first and start the second. echo '<table>'; $query_game = "SELECT team , DATE_FORMAT(gamedate, '%b %d') as date , TIME_FORMAT(gametime, '%l:%i %p') as time , home_score , away_score , winner , opponent , hora FROM ( SELECT h.schoolname as team , gamedate , gametime , home_score , away_score , winner , a.schoolname as opponent , 'h' as hora FROM a_games1920 g JOIN a_schools h ON g.home_id = h.id JOIN a_schools a ON g.away_id = a.id WHERE h.schoolname = '". $school ."' UNION ALL SELECT a.schoolname as team , gamedate , gametime , home_score , away_score , winner , h.schoolname as opponent , 'a' as hora FROM a_games1920 g JOIN a_schools a ON g.away_id = a.id JOIN a_schools h ON g.home_id = h.id WHERE a.schoolname = '".$school ."' ) x ORDER BY team, gamedate"; $result_game = mysqli_query($con,$query_game); echo mysqli_error($con); while($game = mysqli_fetch_assoc($result_game)) { // define home or away $hora = $game['hora']; if ($hora == 'h') { $hora = 'vs'; } else { $hora = '@'; } // Print the schedule echo '<div><tr><td>' . $game['date'] . '</td><td>'. $hora .' ' . $game['opponent'] . '</td>'; If (isset($game['winner'])) { if ($hora =='vs'){ echo '<td>' . $game['home_score'] . '-' . $game['away_score'] . '</td>'; } else { echo '<td>' . $game['away_score'] . '-' . $game['home_score'] . '</td>'; } } else { echo '<td>'. $game['time'] . '</td>'; } echo '</tr></div>'; } echo '</table>';
  5. I have a lot of bad ideas. 😀 That's what the table is named for now. I wouldn't have a table for each season. At worst, I had planned a main table and current season table, then updating the main table after each year. As I learn more, I'm seeing I won't have to do that. I'm slowly getting there.
  6. So I removed the initial gamedate and gametime instances from the query, and it all works. (I don't know why.) 😀 I don't know why it didn't work with the gametime lines, since I was essentially mirroring the gamedate lines, and I don't know why it works now taking gamedate and gametime out of the top part of the query altogether. $query_game = "SELECT team , DATE_FORMAT(gamedate, '%b %d') as date , TIME_FORMAT(gametime, '%l:%i %p') as time , opponent , hora FROM ( SELECT h.schoolname as team , gamedate , gametime , a.schoolname as opponent , 'h' as hora FROM a_games1920 g JOIN a_schools h ON g.home_id = h.id JOIN a_schools a ON g.away_id = a.id WHERE h.schoolname = '". $school ."' UNION ALL SELECT a.schoolname as team , gamedate , gametime , h.schoolname as opponent , 'a' as hora FROM a_games1920 g JOIN a_schools a ON g.away_id = a.id JOIN a_schools h ON g.home_id = h.id WHERE a.schoolname = '".$school ."' ) x ORDER BY team, gamedate";
  7. I want to separate the game time from the game date. Since 95% of game times are 7:30 PM, local time, I would have that as the default value in a separate column then change it when necessary. I added the column gametime, data type: TIME. Then I added gametime to the query (just below all the gamedate instances), but I'm getting 'unknown column' errors. $query_game = "SELECT team , gamedate , gametime , DATE_FORMAT(gamedate, '%b %d') as date , TIME_FORMAT(gametime, '%l:%i %p') as time , opponent , hora FROM ( SELECT h.schoolname as team , gamedate , gametime , a.schoolname as opponent , 'h' as hora FROM a_games1920 g JOIN a_schools h ON g.home_id = h.id JOIN a_schools a ON g.away_id = a.id WHERE h.schoolname = '". $school ."' UNION ALL SELECT a.schoolname as team , gamedate , gametime , h.schoolname as opponent , 'a' as hora FROM a_games1920 g JOIN a_schools a ON g.away_id = a.id JOIN a_schools h ON g.home_id = h.id WHERE a.schoolname = '".$school ."' ) x ORDER BY team, gamedate";
  8. Definitely something more to talk about. I'd have more to learn to get that done. I'm coaching basketball this weekend, so I'll be scarce. I'll DM you more about what we talked about there. I have a thought on something I'd like to share.
  9. I had forgotten to define $school inside the loop. (I had originally defined it from the URL via $_GET for testing purposes.) Now it’s: $school = $row[‘schoolname’] (from the main loop) I think it’s working now that I’ve changed it. So now I’m going expand what is printed.
  10. It's still giving me a blank result: $query_game = "SELECT team , gamedate , DATE_FORMAT(gamedate, '%d-%b-%Y') as date , opponent , hora FROM ( SELECT h.schoolname as team , gamedate , a.schoolname as opponent , 'h' as hora FROM a_games1920 g JOIN a_schools h ON g.home_id = h.id JOIN a_schools a ON g.away_id = a.id WHERE h.schoolname = '". $school ."' UNION ALL SELECT a.schoolname as team , gamedate , h.schoolname as opponent , 'a' as hora FROM a_games1920 g JOIN a_schools a ON g.away_id = a.id JOIN a_schools h ON g.home_id = h.id WHERE a.schoolname = '".$school ."' ) x ORDER BY team, gamedate";
  11. I want the Carmel games in the Carmel section, the Zionsville games in the Zionsville section. (if you looked at that link) https://www.courtsideindiana.com/season-preview/19-20/sectional1920/?sectional=8 $query_game = "SELECT team , gamedate , DATE_FORMAT(gamedate, '%d-%b-%Y') as date , opponent , hora FROM ( SELECT h.schoolname as team , gamedate , a.schoolname as opponent , 'h' as hora FROM a_games1920 g JOIN a_schools h ON g.home_id = h.id JOIN a_schools a ON g.away_id = a.id WHERE h.schoolname = '". $school ."' AND a.schoolname = '".$school ."' UNION ALL SELECT a.schoolname as team , gamedate , h.schoolname as opponent , 'a' as hora FROM a_games1920 g JOIN a_schools a ON g.away_id = a.id JOIN a_schools h ON g.home_id = h.id WHERE h.schoolname = '".$school ."' AND a.schoolname = '".$school ."' ) x ORDER BY team, gamedate"; $school is defined from another query.
  12. Game instance 1: Carmel (h) vs Zionsville Game instance 2: North Central (h) vs Carmel Game instance 3: Zionsville (h) vs North Central
  13. Somehow I think it needs to = $row['schoolname'], which comes from the query defining the Page View.
  14. I mean, it prints all three dates, even though the team is just listed in two of them. I just want the games they're playing in. (That's a fair point on the Sectional part.)
  15. Got rid of the errors (created by thinking I had a few new columns), but right now it's only printing the games of the teams involved in Sectional 8. The Sectional designation is just how the Page Views are organized. When I remove... WHERE h.sectional = 8 AND a.sectional = 8 ...it prints all the games, regardless of who is playing in them.
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.