TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-20-2009, 08:50 AM   #1 (permalink)
The Contributor
 
Join Date: Apr 2008
Location: Nevada, USA
Posts: 52
Thanks: 10
h0ly lag is on a distinguished road
Default How to structure this MySQL data?

Ok, so I am making a script for one of my friends. He is creating lists of movies with their info, such as the poster, a description of the movie, etc... I got this working fine. But he is also listing TV shows with the same generic information. What it's about etc.. Then he has links to each episode. Now my question is, how do I organize the tables in the database to be able to add the episodes to the TV show series, and then bring all this together and be able to have each episode become a clickable link when I put the page together that will read from the database?


This is what I'm thinking:

-Database

--tv
---ID
---series title
---Description

--episodes
---ID
---parent series
---episode name
---description
---more fields, etc..
__________________
Send a message via AIM to h0ly lag Send a message via MSN to h0ly lag
h0ly lag is offline  
Reply With Quote
Old 09-20-2009, 09:53 AM   #2 (permalink)
The Acquainted
 
JaoudeStudios's Avatar
 
Join Date: Jul 2009
Location: Surrey
Posts: 105
Thanks: 1
JaoudeStudios is on a distinguished road
Default

It depends on how generic you want to be between movies and tv shows.

So the schema you propose is that for tv show only?
If so it looks ok, I would change 'parent series' to be tv_id
__________________
JaoudeStudios.com | JaoudeStudios.com Forum | JaoudeStudios.com Blog
OpenSource is the road ahead...!
JaoudeStudios is offline  
Reply With Quote
Old 09-20-2009, 07:41 PM   #3 (permalink)
The Contributor
 
Join Date: Apr 2008
Location: Nevada, USA
Posts: 52
Thanks: 10
h0ly lag is on a distinguished road
Default

Ahh yes, I already have the movie table taken care of. And yes, the parent series would be according to the tv_id. But I have another question, because each series is going to have different amounts of episodes, how will I deal with the amount of columns I am going to need for each show. Oh crap, I just remembered that it will need to be sorted by season as well. So 'Tv_show > Season > Episode.'

Ok, but mainly how do I deal with the amount of columns that I will be needing? because not every show is going to have the same amount of episodes. Should I just be leaving the extra ones blank?
__________________
Send a message via AIM to h0ly lag Send a message via MSN to h0ly lag
h0ly lag is offline  
Reply With Quote
Old 09-20-2009, 08:41 PM   #4 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 312
Thanks: 8
tony is on a distinguished road
Default

It seems like a hierarchy structure, although season doesn't have a lot of data to put on it from the looks of it, so I will go with a 1-to-many relationship between shows > episodes and just make season a field to episodes. Something like this:

Code:
-shows
--show_id
--name
--description

-episodes
--episode_id
--show_idfk
--name
--season
--description
--more fields, etc..
the show_idfk field in the table episodes would help to make the relationship with the shows table (fk stands for foreign key).
tony is offline  
Reply With Quote
The Following User Says Thank You to tony For This Useful Post:
h0ly lag (09-21-2009)
Old 09-21-2009, 07:32 AM   #5 (permalink)
The Contributor
 
Join Date: Apr 2008
Location: Nevada, USA
Posts: 52
Thanks: 10
h0ly lag is on a distinguished road
Default

Thanks tony, I think that will work out very nicely. :)
__________________
Send a message via AIM to h0ly lag Send a message via MSN to h0ly lag
h0ly lag is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing Binary Data in MySQL TheOnly92 General 6 08-29-2009 10:27 AM
Databse structure Village Idiot TalkPHP Developer Team 3 01-16-2009 09:31 PM
want to fetch data in excel sheet from my mysql database sharma.9.pooja Absolute Beginners 2 06-24-2008 05:04 AM
what kind of data can go into a mysql database? sarmenhb General 27 03-04-2008 09:51 AM
Log User Data with PHP & MySQL mortisimus Absolute Beginners 6 09-30-2007 05:52 PM


All times are GMT. The time now is 02:00 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design