Jump to content

Archived

This topic is now archived and is closed to further replies.

lpxxfaintxx

How should I set up the Database?

Recommended Posts

I am using PHP-Fusion. I want to make it so that EVERY registered user has its OWN uploader and its OWN photo gallery. How should I set up the database so that each individual user has its own column? Should I create a new table, or should I insert a new field? How would the database work? Will it create a new field for every new uploaded file? AH! I'm getting so frustrated.

Please Help,
lpxxfaintxx

I really am desperate.

Share this post


Link to post
Share on other sites
Basically you need 2 tables, one for users and one for image filenames

[code]user          gallery
=========     =======
userID  --+   galleryID
username  +-- userID
pwd           imagefile[/code]

When a user uploads an image file, add a new reocord to the gallery table with the user's id and the filename. Store the uploaded file in, say, "/images/username/filename.jpg".

A search on userID in the gallery table will pull that user's filenames.

Share this post


Link to post
Share on other sites
Third table, category, and add category id to gallery records

[code]user          gallery         category
=========     =======         ==========
userID  --+   galleryID  +---  catID
username  +-- userID     |     cat_name
pwd           imagefile  |
              catID  ----+[/code]

Share this post


Link to post
Share on other sites
It's just to illustrate the foreign key/primary key joins in the database.

Share this post


Link to post
Share on other sites

×

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.