Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/162348-setting-up-database/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/162348-setting-up-database/#findComment-856976
Share on other sites

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

 

Link to comment
https://forums.phpfreaks.com/topic/162348-setting-up-database/#findComment-857019
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/162348-setting-up-database/#findComment-857312
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.