Jump to content

Tables / databases help


undertaker

Recommended Posts

Example: I want to build a webpage where registered user can upload his images.

 

- All uploaded images (from all users) show up on frontpage. Ascending by newest first.

- If user opens his control panel, he can preview all his uploaded images, image likes (stats), etc.

 

My question is how to form databases and tables for best performance, when calling the data to show up.

 

For example:

 

Table with users:

 

username | password | money

mike            123456      20

jack              mypass4    0

henry            gg56          500

 

Table with images:

 

username | image | likes

mike            jack.jpg  20

jack              5265.jpg  40

jack            56589.jpg  40

 

 

 

 

 

 

Link to comment
Share on other sites

You should look into adding a unique ID column to your users table. Then instead of linking the two tables by the username, you would link them with the ID. This way if the username changes, you won't need to update multiple tables.

 

Also, if you want to display the users in ascending order you might want to add a datetime column to your users database.

 

I would also recommend that you look into encrypting or hashing the passwords.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.