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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.