Old 21-10-2004, 18:11   #1 (permalink)
NickToye
Senior Member
 
Join Date: Oct 2004
Location: Chester
Posts: 364
Sample Application

Hi,

I am a bit of a newbie here, so please bear with me.

I am trying to develop a sample application for a restaurant. I have two tables in my database:

menuType
menu

menuType has 2 fields

id_type(pk)
title_type

menu has 5 fields

id_menu(pk)
idtype_menu(fk)
title_menu
description_menu
price_menu

Ok, so in Dreamweaver I have managed to display my menu types in the index page:

starters
mains
desserts

In my menu.php page I want to be able to dynamically display the starters or whatever I select from the index.php.

Ok, so far this is working, apart from when I try to dynamically load in the starters etc...

Here is the sql query that I use to define my record set in the menu.php page:

SELECT *
FROM menu INNER JOIN menuType ON idtype_menu = id_type
WHERE idtype_menu = colname

And in the variables box I have:

Name Default Value Run-time Value
colname 1 $_GET['idtype_menu']

Any suggestions to how I can get this to work. If someone is interested in helping me, I can email the files so you can see more clearly what I am getting at.

Many thanks in advance.

Nick
  Reply With Quote
Old 22-10-2004, 03:18   #2 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,206
OK so for instance you want to click starters on index.php and be taken to a list of all the starters in menu.php? right?

No need for the INNER JOIN.

Code:
SELECT * FROM menu WHERE idtype_menu = colname

colname is the menu type's id.
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 22-10-2004, 05:42   #3 (permalink)
NickToye
Senior Member
 
Join Date: Oct 2004
Location: Chester
Posts: 364
Ok, cool, I actually worked it out but I never got rid of the Inner Join. I suppose it works regardless of this bit of sql. Out of interest what is the benefit of INNER JOIN?
  Reply With Quote
Old 22-10-2004, 05:53   #4 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,206
Inner Join is used when you would like to select one or more rows from two or more related tables.
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8