Jump to content

Confused on how to approach database


RottenBananas

Recommended Posts

Hello,

I hope this is in the right section.

 

So im trying to make myspace from scratch on my localhost to learn php. I dont know what to do with the database(im new to mysql and php).

 

So far I have one table that holds everything...username, email, name blah blah

Here are my questions:

 

1. Assuming my site was real and I had millions of users what are the pros/cons of having all that info in one table? I have a weird feeling having it all in one table is dumb but i dont know any better.

 

2. If i make separate tables how can I access the same row from diff tables. For example I have users table and files table for their pics. users has an id, how do i know that this id corresponds to these pics in the files table?

 

3.I want to have it so they can upload music. What field could that be? Do i need a separate field for every song they upload? or a new table for every user?

 

Just confused on the database stuff I've never worked with them before

 

Your help is much appreciated

Thanks!

Link to comment
Share on other sites

OK i wanna make sure i have this right before actually making changes to the db.

 

Users table : id, name, username, password, email

Files table : id, song_id, name, type, size, content(the actual file)

 

To get user X's files i would select * from files where id=$_SESSION['id'];

 

Now do i need song_id? If its the primary key and auto increments itll span across different users.

...sorry im still confused ???

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.