Jump to content

Using data in multiple tables (in 1 database)


Lucky2710

Recommended Posts

I have 4 tables "a users table" "a teams table" "a games table" and "a picks table"

 

 

Tables are set up like this...

 

Games        Teams        Picks              Users

- ID            - ID          - ID                - id

- Week        - Team      - User_ID        - full_name

- Away                          - Game_ID    - user_name

- Home                          - Pick            - password

 

 

My issue is getting the data from the multiple tables at one time.

Like i need to pull from teams the team name into games  (away and home) each team has a different id and in the games table in the way spot is that teams id. so how do u pull the team name depending on what is in the away field.

 

If i can figure that out i can figure the rest out on my own. but i dont have a clue how to do that major starting place.

 

My plan is to use php to echo the data onto the page.

 

Thanks for any help i can get!

 

Server version is 5.1.42

Client Version is 5.1.37

Apache/2.0.52  (Red Hat)

$result1 = mysql_query("SELECT  CollegeFootballGames.ID, CollegeFootballGames.Week,  CollegeFootballGames.Away, CollegeFootballGames.Home, CollegeFootballTeams.Team
FROM CollegeFootballGames INNER JOIN CollegeFootballTeams
ON CollegeFootballGames.Away = CollegeFootballTeams.ID || CollegeFootballGames.Home=CollegeFootballTeams.ID");
while ($row = mysql_fetch_object($result1)) {
    $GameID[] = $row->ID;
    	$Teams[] = $row->Team;

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.