Page 1 of 1
Help with PHP/MySQL
Posted: Mon Apr 17, 2006 6:38 am
by kgpri2
Hi all,
I'm creating a website that will (primarily) have thousands of videos. Rather than using a template to create a new HTML page for each new video(i.e. to avoid having to create thousands of HTML pages), I want to use PHP so that clicking a particular video link will 1. open the (one and only) video player page and 2. get the relevant video file. I've configured PHP/MySQL/Apache/phpMyAdmin and have them running smoothly. I'm not sure if I need to create a database in MySQL to hold the videos(and/or their details) or whether PHP code alone will be sufficient.
Thanks guys
Posted: Mon Apr 17, 2006 6:47 am
by Chris Corbyn
Yes you'll want a database to do it correctly. The database is for storing information... the PHP code contains the logic for handling it.
Posted: Mon Apr 17, 2006 7:10 am
by kgpri2
Ok cool.
What fields do I need to have on the videos table in the database?
Thanks
Posted: Mon Apr 17, 2006 7:17 am
by Chris Corbyn
That really depends upon what information you're going to need. What sort of videos (hmm.. actually lets not

).
Lets say they were actual movies you might want several tables to hold information like what studio the moview was shot at, who produced it. Then in the main table specific to that movie you might want release date, movie name, stars, certificate etc.
You need to decide what information you're going to need to have access to.
Posted: Mon Apr 17, 2006 7:35 am
by kgpri2
Thanks for your help d11wtq.
Ok, let me assure you our project is G rated.
I only really need to record the title and description for each video. So one table would be sufficient right?
The question I really need an answer to is, does the database actually hold the file or do you only enter into each field the location/address of the video file? How do you do this? Is there a relevant function in phpmyadmin?
Thanks again
Posted: Mon Apr 17, 2006 7:39 am
by Chris Corbyn
kgpri2 wrote:Thanks for your help d11wtq.
Ok, let me assure you our project is G rated.
I only really need to record the title and description for each video. So one table would be sufficient right?
The question I really need an answer to is, does the database actually hold the file or do you only enter into each field the location/address of the video file? How do you do this? Is there a relevant function in phpmyadmin?
Thanks again
Sounds like one table should be enough yes.
It's possible to store binary data in the database yes (the video) but it's not a good idea if you can avoid it since it's pretty slow and just creates extra work when transferring that data agin with the correct headers.
The best thing to do is to rename the file on upload, then store it's path in the database.
Posted: Mon Apr 17, 2006 7:54 am
by kgpri2
Thanks again.
Ok, so does the field that contains the video paths need to have settings so that the database knows it is a path (and not just text)?
Really elementary stuff, I know. But I'm having trouble finding tutorials/info that specifically relates to this... Any recommendations?
Posted: Mon Apr 17, 2006 8:15 am
by Chris Corbyn
kgpri2 wrote:Thanks again.
Ok, so does the field that contains the video paths need to have settings so that the database knows it is a path (and not just text)?
Really elementary stuff, I know. But I'm having trouble finding tutorials/info that specifically relates to this... Any recommendations?
A field of type varchar should be sufficient. PHP will read that data as a string which it can place into the web page in a hyperlink, or an embed or such like.