undertaker Posted May 13, 2011 Share Posted May 13, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/236298-tables-databases-help/ Share on other sites More sharing options...
cyberRobot Posted May 13, 2011 Share Posted May 13, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/236298-tables-databases-help/#findComment-1214937 Share on other sites More sharing options...
undertaker Posted May 13, 2011 Author Share Posted May 13, 2011 thanks Quote Link to comment https://forums.phpfreaks.com/topic/236298-tables-databases-help/#findComment-1215014 Share on other sites More sharing options...
Xtremer360 Posted May 13, 2011 Share Posted May 13, 2011 Since he wants the newest first wouldn't that be Descending? Quote Link to comment https://forums.phpfreaks.com/topic/236298-tables-databases-help/#findComment-1215043 Share on other sites More sharing options...
cyberRobot Posted May 13, 2011 Share Posted May 13, 2011 Since he wants the newest first wouldn't that be Descending? Yep, good point. I was paying too much attension to the OP. Quote Link to comment https://forums.phpfreaks.com/topic/236298-tables-databases-help/#findComment-1215047 Share on other sites More sharing options...
jcbones Posted May 14, 2011 Share Posted May 14, 2011 Take a minute, and go through . It will save you loads of time in the future. Go through all 9 video's. Then your database structure will be the most efficient that it could be. Quote Link to comment https://forums.phpfreaks.com/topic/236298-tables-databases-help/#findComment-1215249 Share on other sites More sharing options...
undertaker Posted May 16, 2011 Author Share Posted May 16, 2011 Thanks everyone Quote Link to comment https://forums.phpfreaks.com/topic/236298-tables-databases-help/#findComment-1216067 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.