Answered
MySQL database relation question
I'm setting up a site where registered users can catalog
their Japanese Vinyl toys (i.e. vinyl kaiju). I have 2 tables:
collection
members
members has an ID that is specific to each member (naturally). within collection I have kaijuID and userID.
What I need to figure out is the best way to get the ID from the member table to populate within the collection table, thus allowing each registered user to see just their collection.
I can wrap my head around displaying the collection based on the user ID -- I just can't figure out where to add the user ID information into the collection database.
The site structure has:
login page
member home page
add kaiju
view kaiju
update kaiju
search kaiju
the add / view / update / search pages will all utilize the ID's. Not a big deal since I can have the user ID as a base for the results on these pages. it's the adding a new kaiju part that I can't figure out. Where would this form associate the logged in user so that it silently adds in their ID along with the toy info? A hidden field would be a natural assumption -- would that be part of the submit action?
So basically here's the breakdown:
User A has an ID of 001
User A wants to catalog 2 kaiju: Godzilla and Gamera
When User A submits these two each will need to have the 001 user ID added to the collection table column labeled as userID (which is the same as the column in the member table).
Which will allow the viewed collection to specifically show just member 001's collection.
phew. Any suggestions would be appreciated. I looked through the CS3 documentation and got this far but didn't see anything for relational databases.
Thanks!
collection
members
members has an ID that is specific to each member (naturally). within collection I have kaijuID and userID.
What I need to figure out is the best way to get the ID from the member table to populate within the collection table, thus allowing each registered user to see just their collection.
I can wrap my head around displaying the collection based on the user ID -- I just can't figure out where to add the user ID information into the collection database.
The site structure has:
login page
member home page
add kaiju
view kaiju
update kaiju
search kaiju
the add / view / update / search pages will all utilize the ID's. Not a big deal since I can have the user ID as a base for the results on these pages. it's the adding a new kaiju part that I can't figure out. Where would this form associate the logged in user so that it silently adds in their ID along with the toy info? A hidden field would be a natural assumption -- would that be part of the submit action?
So basically here's the breakdown:
User A has an ID of 001
User A wants to catalog 2 kaiju: Godzilla and Gamera
When User A submits these two each will need to have the 001 user ID added to the collection table column labeled as userID (which is the same as the column in the member table).
Which will allow the viewed collection to specifically show just member 001's collection.
phew. Any suggestions would be appreciated. I looked through the CS3 documentation and got this far but didn't see anything for relational databases.
Thanks!
