PHP and SQL - Relational Databases
Posted: Mon Aug 23, 2010 5:06 am
I'm still working on implementing my database design that I've mentioned in a few other threads lately and I'm running into a few questions as I go that I can't seem to get a straight answer on, but i've figured a decent way to word them - hoping someone can provide me with a decent answer!
I have 5 tables:
tblProject
tblDwelling
tblDoorType
tblWallType
tblWindowType
A user creates a new project, that project can have one dwelling associated with it. Each dwelling can be made up of multiple door types, wall types and window types. Each table obviously has a unique ID. The dwelling also has a project ID as an FK, door/window and wall each have a dwelling ID as an FK.
What is the best way to implement this in PHP? I have created a form to create a new project and generate an ID and project name - how do I go about taking that ID, storing it (as a foreign key) in the dwelling and creating a new dwelling. Same goes for each indidual window/door/wall. I really am struggling to get my head around this andwould appreciate any help! Do i need to run a query to grab the project and dwelling ID and store in a session or what? Extremely confused here.
Cheers.
I have 5 tables:
tblProject
tblDwelling
tblDoorType
tblWallType
tblWindowType
A user creates a new project, that project can have one dwelling associated with it. Each dwelling can be made up of multiple door types, wall types and window types. Each table obviously has a unique ID. The dwelling also has a project ID as an FK, door/window and wall each have a dwelling ID as an FK.
What is the best way to implement this in PHP? I have created a form to create a new project and generate an ID and project name - how do I go about taking that ID, storing it (as a foreign key) in the dwelling and creating a new dwelling. Same goes for each indidual window/door/wall. I really am struggling to get my head around this andwould appreciate any help! Do i need to run a query to grab the project and dwelling ID and store in a session or what? Extremely confused here.
Cheers.