Jump to content

Multiple Table Select


bschultz

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

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.