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
https://forums.phpfreaks.com/topic/236298-tables-databases-help/
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.

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.