Jump to content

help with relation between table


nec9716

Recommended Posts

Hello every one

 

I have 2 table

 

1- user name,team name

2- driver,engine,chassis

 

in a form I select a team name from table 1 and driver,engine and chassis from table 2

 

on one page I show the selection ....how can I print on the page the user name ( user name related to the team name )

 

to have something like that:

 

user name - team name - driver - engine - chassis

 

 

thank you

Link to comment
https://forums.phpfreaks.com/topic/99638-help-with-relation-between-table/
Share on other sites

well the script have 731 lines....I don't think there a nice guy who will be ready to read all thoses lines..

 

Can I post here a link to the page I talk about ?

 

ok I will try to be more explicit

 

table A have :

Aid

ANAME

ATEAM NAME

AEMAIL

 

 

table B have:

Bid

BDRIVER NAME

BENGINE

BCHASSIS

 

table C have:

Cid

CTeam name

Cdriver name

Cengine

Cchassis

 

In a form I select from a dropdown menu

-ATEAM NAME ( from table A )

- BDRIVER NAME ( from table B )

- BENGINE (from table B )

- BCHASSIS ( from table B )

 

this data is transfer to table C where I collect the selections from the form page

the result is print in result.php page.

 

 

 

now my question is if I want to print the ANAME  who go with the ATEAM NAME in result page how can I do that

 

I'm sorry but I don't know how you say association or relation maybe?

 

 

 

 

Well. there's a few things you could improve on that database design, but to answer your question quickly, with the current design, you would:

 

SELECT `ANAME` FROM tablea WHERE `ATEAM_NAME` = 'ateam_name_here';

 

But you can greatly improve that design if you follow a few guidelines. To start with field names should be lowercase, or camel case. never all uppercase. It's not a matter of necessity really, but of taste. A common practice in SQL language construction is to have SQL keywords in all uppercase and database field and table names in lowercase for easier reading.

 

I could probably help you improve your database design and create a good relationship between your tables. But I would need more details about some of those fields.

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.