Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code> $results= mysql_query("SELECT 'tbl_games.game_ID', 'tbl_games.game_date', 'tbl_teams.team_name' FROM tbl_teams, tbl_games WHERE 'tbl_games.team1_ID' = 'tbl_teams.team_ID' AND 'tbl_games.team2_ID' = 'tbl_teams.team_ID' AND 'tbl_games.team1_score' IS NULL AND 'tbl_games.team2_score' IS NULL"); </code></pre> <p>should be:</p> <pre><code> $results= mysql_query("SELECT `tbl_games`.`game_ID`, `tbl_games`.`game_date`, `tbl_teams`.`team_name` FROM tbl_teams, tbl_games WHERE `tbl_games`.`team1_ID` = `tbl_teams`.`team_ID` AND `tbl_games`.`team2_ID` = `tbl_teams`.`team_ID` AND `tbl_games`.`team1_score` IS NULL AND `tbl_games`.`team2_score` IS NULL"); </code></pre> <p>You were using the wrong type of quotes, and the <code>.</code> must not be inside the quotes.</p> <p>Since none of your table or column names are reserved words, you could do it without the quotes entirely:</p> <pre><code> $results= mysql_query("SELECT tbl_games.game_ID, tbl_games.game_date, tbl_teams.team_name FROM tbl_teams, tbl_games WHERE tbl_games.team1_ID = tbl_teams.team_ID AND tbl_games.team2_ID = tbl_teams.team_ID AND tbl_games.team1_score IS NULL AND tbl_games.team2_score IS NULL"); </code></pre> <p>I think the actual query you may want is this:</p> <pre><code>SELECT tbl_games.game_ID, tbl_games.game_date, tbl_teams.team_name FROM tbl_teams, tbl_games WHERE (tbl_teams.team_ID = tbl_games.team1_ID AND tbl_games.team1_score IS NULL) OR (tbl_teams.team_ID = tbl_games.team2_ID AND tbl_games.team2_score IS NULL) </code></pre> <p>This finds all the games that each team is scheduled to play in, and they have a null score.</p> <p><a href="http://www.sqlfiddle.com/#!2/4b0c1/4" rel="nofollow">SQLFIDDLE</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload