php - mySQL Table Structure for a User-based website -


I am developing a website that has user profiles, account, account settings, inbox, etc. such as Facebook or LinkedIn And I 'm wondering how to set up mySQL tables for this

Can I create a table for each user for each function (profile, inbox, etc.)?

In the case of relationships (as outlined by other posters), all the things you have in a database Need to think about For example, if you have a user with a multiple from one relationship with things like mail, there will be a one by one relationship with their user profile, And they will have a a lot of relationships with some people like 'places', where many users live in a city.

As you are preparing your database, always ask yourself which type of connection you want when you do not need it, you try to duplicate the data in several tables at any time. Should not.

When you set something like a user table, make sure every line is equal to the user (unlike every user is a desk) and every line has a unique auto-increment ID This user ID (which is generated by MySQL) is going to be the context used in other tables to link your data together.

So when you set up your mail table, you may have 15 lines with email data, but each of those lines will have a name that will be called a user_id There will be a name in which the user will have unique ID from the user table.

Get started by getting acquainted with things like LEFT JOIN - this way you will run a single query and for example, you can get your user's data and all its emails in one go.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -