Jump to content

selecting data from mutiple tables


wrathican

Recommended Posts

hey there

what i have is two tables, one with tours and one with courses, why i didnt use one table to begin with is a mystery to me and might eventually happen, but until then i need to select data from both tables to show in a combo box in a form.

im going to be using php to show them in the form, hopefully a while statement to show the selections available.

 

what im wondering is how do i do this?

what sort of query would it be?

would i need to use two queries?

 

im pretty confident at using while loops and selecting data from databases but not two tables at the same time.

 

thanks in advanced guys

Link to comment
https://forums.phpfreaks.com/topic/59708-selecting-data-from-mutiple-tables/
Share on other sites

A nice way to do this would be AJAX, you show Tours and based on the tour they select theywill get a drop down with the course belonging to each tour, im i correct?

 

anyway, here is a good tutorial that help me when i had to do something similar to what you are doing now.

 

http://www.scriptygoddess.com/archives/2007/02/13/store-locator-using-php-and-ajax/

 

you just need a few changes to customize it to you needs.

i had a look at that and i didnt like the look of it.

 

what i want to happen, is to create a query to select the name and price from two tables, one called tours and one called courses, then display the titles in a drop down list on a form for the user to select which course/tour they are interested in going on. once the user selects a course/tour i want the price thats stored in the table for that course/tour to be displayed.

 

the courses and tours are not the same thing, they are seperate but both contain similar data

 

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.