bschultz Posted May 26, 2011 Share Posted May 26, 2011 I'm having a problem with a multiple table select. <?php //get who is already working list $sql = "SELECT ump_id.scheduled_umps, game_id.games, game_id.scheduled_umps, day.games FROM scheduled_umps, games WHERE `day.games` = '$game_day_array' AND `game_id.scheduled_umps` = '$game_id_array'"; echo $sql; $rs = mysql_query($sql,$dbc); while($row = mysql_fetch_array($rs)) { echo $row['ump_id']; $already_working_array[] = $row['ump_id.scheduled_umps']; } if (!$rs) { echo "i found nothing here"; } ?> This returns [quote] Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/briansch/public_html/bemidjiumps.com/secure/pages/schedule_game.php on line 69 i found nothing here [/quote] AND [quote] Warning: array_diff() [function.array-diff]: Argument #2 is not an array in /home/briansch/public_html/bemidjiumps.com/secure/pages/schedule_game.php on line 83 [/quote] The table scheduled_umps has the game_id and the ump_id for that game. The table games has the game_id and the day. So, I need the day (defined earlier in the code...and working...) of ONE game that day. Then, I need to find ALL the game_id's of that day (all from the games tables). Then, I need to compare the game_id's of that day, to the scheduled_ump table, to see which ump_id is already scheduled that day. Make sense? Any idea's what I'm doing wrong? Thanks! Link to comment https://forums.phpfreaks.com/topic/237501-multiple-table-select/ Share on other sites More sharing options...
bschultz Posted May 26, 2011 Author Share Posted May 26, 2011 By the way...here's the echo of the $sql: SELECT ump_id.scheduled_umps, game_id.games, game_id.scheduled_umps, day.games FROM scheduled_umps, games WHERE `day.games` = '2011-06-01' AND `game_id.scheduled_umps` = '1' As far as I can tell...that looks right to me. Link to comment https://forums.phpfreaks.com/topic/237501-multiple-table-select/#findComment-1220431 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.