Jump to content

Need help with database structure


Guest MrLeN

Recommended Posts

I am trying to build a database like this:

 

Username Table (user details)

 

- Username [PRIMARY]

- Advertising Code 1

- Advertising Code 2

- Website name

- Website URL

- Statistics Code

 

I can pretty much make that part. HOWEVER, I have created a form that allows the user to enter YouTube URL with the following form fields:

 

YouTube Video ID table (this is for each video)

 

-YOUTUBE VIDEO ID [PRIMARY]

- YouTube Video Title

- YouTube Video Description

- Comment; ie: the user can add additional text about the video

- Advertising Code 1

- Advertising Code 2

- Website name

- Website URL

 

I want the video ID to be associated with the Username.

 

HOWEVER, I can't just have all the video ID's in atable, because multiple users might add the save video ID.

 

So, I need something like this:

 

- Username [PRIMARY]

- Advertising Code 1

- Advertising Code 2

- Website name

- Website URL

- Statistics Code

----YOUTUBE VIDEO ID 1

----YouTube Video Description

----Comment; ie: the user can add additional text about the video

----Advertising Code 1

----Advertising Code 2

----Website name

----Website URL

----YOUTUBE VIDEO ID 2

----YouTube Video Description

----Comment; ie: the user can add additional text about the video

----Advertising Code 1

----Advertising Code 2

----Website name

----Website URL

 

How can I accomplish this?

 

I am not very good with databases. I know how to create a database, and I know what tables and rows are. I can create a very simple database, but what I want to do above is beyond my ability to make. I need some guidance on what to do :)

Link to comment
Share on other sites

The current layout doesn't make sense, because you simultaneously want videos to be user-bound (there's a comment field) and not user-bound (you only use the Youtube ID as an identifier).

 

Either you add the user ID to the video table and make the pair(!) of Youtube ID and user ID the primary key. Or you create an extra junction table where you assign user IDs to video IDs and store user-specific data like the comment.

Edited by Jacques1
Link to comment
Share on other sites

For starters, when you are naming columns like some_column1, some_column2 etc, you are already heading the wrong direction. Look up and learn Database Normalization.

 Is that because underscores are used as table prefixes and if I put them in column names, I could cause a big headache?

 

Should I take the underscores out?

Link to comment
Share on other sites

I read them but I do not understand them properly. I am not a very good programmer. I tried to make a database, but it's too complicated. 

I am ok with front end stuff and can write php, but databases for me.. it really does my head in.

 

Link to comment
Share on other sites

And I really want to get my script working today, so I can get back to what I am good at -- promotion.

I am the worst programmer in the southern hemisphere.

I am not joking.

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.