Jump to content

Membership area logic question


Grant Holmes

Recommended Posts

Hey gang. A little discussion here. I need to create a membership area. I found a script here from http://phpsnips.com/snippet.php?id=16 That would allow creation of a basic user.

 

We're going to collect other basic demographic information, including a couple photos. I assume I should only use one database. Should I have this initial user file setup information (above) ONLY in one table and all the other information (call this demographic stuff) in another table? Should the photo images (ONLY) be in a totally separate table, or should the images be in with the demographic stuff?

 

I know little about PHP and nothing about "Joining" tables, but I'm learning.

 

Please give me guidance on how best to proceed.

Link to comment
https://forums.phpfreaks.com/topic/92929-membership-area-logic-question/
Share on other sites

Personally, I would have photos being in their own table, each photo having its own row and having reference back to a unique id for whatever user that photo belongs to. From there you can pull all the photos from the table depending on what id you're referring to. Make sense?

the question of if I need a new table for some data comes down to answering the question

 

"Can I have all this data stored in rows that are linked by a single key"

 

If the answer is no make tables to satisify it

 

If its yes you are good

 

In your case the answer is no because the photos need to be many photos to 1 row, and mysql doesn't expand that way naturally (adding additional fields)

You'll actually want to look into "relational database tables".  There are several good articles on the web about them.  As a previous reply mentioned, the a great way to think about it is "does all this information fit easily on one row".  You might also want to ask yourself "is this information likely to be duplicated over and over again within my rows".  If so...and dependent on the complexity of the information...you'll also want to build a separate table for that information.

 

If you take some time to build your database tables correctly, you will save a myriad of headaches down the road.

Thanks all for the great informative replies.

 

In this case, we'd be limiting users to five image, not unlimited.

And for the most part, I FEEL like it could be in one row, one for each user.

 

Is there "more security" in having 'user' information separate from 'demographic' information? I would think this would be moot, but am unsure.

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.