N-Bomb(Nerd) Posted June 16, 2009 Share Posted June 16, 2009 Hello, I'm pretty new to designing databases and I'm not quite sure as to how one would set something up as I need. In my database I'll have the following information that won't have additional rows added to it.. will just be updated as needed: Username, Picture, Notes, Date Added to DB However, that's just for their information.. because each user will also be tracked on their comments they've left, which would be following (will have many rows as each new row will be a comment they've left): Comment, Date Posted, CommentID, CommentU, CommentSect As I said I'm pretty new to databases, so could someone explain the proper way of setting this up? Quote Link to comment https://forums.phpfreaks.com/topic/162348-setting-up-database/ Share on other sites More sharing options...
RichardRotterdam Posted June 16, 2009 Share Posted June 16, 2009 I'd start with the entities before you start filling the fields. So far I see the following: Users Pictures Comments After you've done that you can set the relations and properties of these entities Is this correct so far? Quote Link to comment https://forums.phpfreaks.com/topic/162348-setting-up-database/#findComment-856931 Share on other sites More sharing options...
Zane Posted June 16, 2009 Share Posted June 16, 2009 do you have phpmyadmin installed? It's pretty straight forward once you set that up. Quote Link to comment https://forums.phpfreaks.com/topic/162348-setting-up-database/#findComment-856934 Share on other sites More sharing options...
N-Bomb(Nerd) Posted June 16, 2009 Author Share Posted June 16, 2009 I'd start with the entities before you start filling the fields. So far I see the following: Users Pictures Comments After you've done that you can set the relations and properties of these entities Is this correct so far? So, would those be the 3 tables that I should use? How would I be able to correctly identify what pictures or comments belongs to which user though? Quote Link to comment https://forums.phpfreaks.com/topic/162348-setting-up-database/#findComment-856976 Share on other sites More sharing options...
RichardRotterdam Posted June 16, 2009 Share Posted June 16, 2009 So, would those be the 3 tables that I should use? With the given input I guess that could be your tabels yes. How would I be able to correctly identify what pictures or comments belongs to which user though? That's where relations come in using foreign keys i suggest you read up on that. The following could be your relations 1 User has many Pictures 1 Picture has many Comments Quote Link to comment https://forums.phpfreaks.com/topic/162348-setting-up-database/#findComment-857019 Share on other sites More sharing options...
N-Bomb(Nerd) Posted June 16, 2009 Author Share Posted June 16, 2009 I've tried looking up foreign keys, and I'm not coming up with much information. Could you link me to some resources, and perhaps show me an example query as to where I could use the id from the users table and connect it with something in the comments table all within the same query? Quote Link to comment https://forums.phpfreaks.com/topic/162348-setting-up-database/#findComment-857312 Share on other sites More sharing options...
RichardRotterdam Posted June 16, 2009 Share Posted June 16, 2009 I've tried looking up foreign keys, and I'm not coming up with much information. Uhm Are you sure about that??? http://lmgtfy.com/?q=mysql+foreign+%20key Quote Link to comment https://forums.phpfreaks.com/topic/162348-setting-up-database/#findComment-857336 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.