nec9716 Posted April 5, 2008 Share Posted April 5, 2008 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 More sharing options...
quiettech Posted April 5, 2008 Share Posted April 5, 2008 I'm sorry nec. I cannot understand your question. Please run 'DESCRIBE table_name' on your two tables and post the results here. Also try to present code for that form of yours and describe in other words what is it you want to display. Link to comment https://forums.phpfreaks.com/topic/99638-help-with-relation-between-table/#findComment-509719 Share on other sites More sharing options...
nec9716 Posted April 5, 2008 Author Share Posted April 5, 2008 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? Link to comment https://forums.phpfreaks.com/topic/99638-help-with-relation-between-table/#findComment-509728 Share on other sites More sharing options...
quiettech Posted April 5, 2008 Share Posted April 5, 2008 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. Link to comment https://forums.phpfreaks.com/topic/99638-help-with-relation-between-table/#findComment-509916 Share on other sites More sharing options...
nec9716 Posted April 5, 2008 Author Share Posted April 5, 2008 Please run 'DESCRIBE table_name' on your two tables and post the results here... I don't mind but ....how can I do that? Link to comment https://forums.phpfreaks.com/topic/99638-help-with-relation-between-table/#findComment-509938 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.