Hi everyone,
Right I've got a gaming website, and I would like to offer to visitors also my users to watch video trailers etc. But the problem is that I wouldn't want to create loads of static pages just to play so many videos as that would like take forever to accomplish.
Now onto what I'am after:
1. Use PHP + MySQL.
2. In the MySQL Database insert information for the video trailer,
for example (Video Name, Video Location, and also to have its own unique ID)
3. When a User or Visitor types in for example www.mywebsite.com/videos/player.php?id=1234,
and that unique ID is in the MySQL database and with its usual info for the video
(e.g. Video Name, Video Location. etc).
This form of playing videos on websites is used on various of different sites, but the thing is that I'm suppose to be launching my website around 21 days and I need a video system like that as it would help me alot.
If anyone could help I would appreciate it very much!
Benny852
Need to know how to do MySQL/PHP video stream.
Started by Benny852, Aug 28 2006 04:37 PM
6 replies to this topic
#1
Posted 28 August 2006 - 04:37 PM
#2
Posted 28 August 2006 - 04:53 PM
So are you asking for help or are you asking for someone to produce a script? if its the latter then the help section isnt for that
#3
Posted 28 August 2006 - 04:57 PM
I wouldn't say I was asking for someone to produce it for me, I was aiming at like if someone could guide me through the processes and procedures and I'll do it all my self like add the pages and so on...
Hope this is the right section for this I've only been registered for like 5 minutes
Hope this is the right section for this I've only been registered for like 5 minutes
#4
Posted 28 August 2006 - 05:02 PM
Well i can past some handy links along 
http://uk2.php.net/mysql
http://uk2.php.net/m...mysql-query.php
http://pixel2life.com/tutorials/php_coding...ql_integration/
I can write some simple examples of insert/select/update/delete which is all you need really later on, for now i need to close my eyes lol.
http://uk2.php.net/mysql
http://uk2.php.net/m...mysql-query.php
http://pixel2life.com/tutorials/php_coding...ql_integration/
I can write some simple examples of insert/select/update/delete which is all you need really later on, for now i need to close my eyes lol.
#5
Posted 28 August 2006 - 05:13 PM
Thanks for the handy links matt!
If you could write some it would be much appreciate, the other thing is I've already did half of it like setup the MySQL database and done the .php file which is 'player.php' which will be the page to display all videos that the database contains. Also setup the query to get the information from the database but for some reasons it won't get the video information that I have already inserted into the database.
So far I have done:
1. Setup the MySQL database.
2. Setup the php page (player.php).
3. Add the needed mysql connect scripts.
4. Added 'Windows Media Player Embedded' to play the media files.
But it just won't get the information thats within the MySQL database, for sure has puzzled me but if you got a solutation around that it would be appreciated very much!
If you could write some it would be much appreciate, the other thing is I've already did half of it like setup the MySQL database and done the .php file which is 'player.php' which will be the page to display all videos that the database contains. Also setup the query to get the information from the database but for some reasons it won't get the video information that I have already inserted into the database.
So far I have done:
1. Setup the MySQL database.
2. Setup the php page (player.php).
3. Add the needed mysql connect scripts.
4. Added 'Windows Media Player Embedded' to play the media files.
But it just won't get the information thats within the MySQL database, for sure has puzzled me but if you got a solutation around that it would be appreciated very much!
#6
Posted 28 August 2006 - 05:41 PM
You need to give us code before we can even hope of helping you... we aren't phychic... yet. 
Here's a snippet from my own video 'system' I guess you could call it from my own site. (Example Index)
Just simple query and retrival of the data, nothin' more than that.
As for a video index page such as mine, it's the exact same thing, only minus the video code of course, and within a while loop.
Here's a snippet from my own video 'system' I guess you could call it from my own site. (Example Index)
<?php
// Connect details here
$result = mysql_query("SELECT * FROM `videos` WHERE id = $_GET[vid]");
// Retrieve all MySQL data as an array and assign to variables
$videos = mysql_fetch_array($result);
$vid = $_GET['vid'];
$count = $videos['count'];
$vid_name = $videos['name'];
$video = $videos['video'];
$comment = $videos['comment'];
$avatar = $videos['avatar'];
$size = size_hum_read(filesize("videos/".$videos['video']));
?>
<table width="390" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div class="header"><?php echo $vid_name ?></div>
<div class="content" align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="tut_stats">
<tr>
<td style="padding:3px;" width="160">
<a href="/video/<?php echo $vid ?>"><img src="/videos/<?php echo $avatar ?>" height="120" hspace="10" vspace="5" width="160" style="border:1px solid #000;"></a>
</td>
<td valign="top">
<a href="/video/<?php echo $vid ?>"><strong><?php echo $vid_name ?></strong></a><br />
<?php echo $comment ?>
<br /><br /><span style="float:left;"><strong>Size: <?php echo $size ?></strong></span><span style="float:right;text-align:right;"><strong>Viewed <?php echo $count+1 ?> times.</strong><br /><?php echo $show_rating ?></span>
</td>
</tr>
</table>
<div style="width:320px;height:240px;border:1px solid #000;">
<object classid="CLSID:22D6F312-B0F6-11DO-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" width="320" height="240" type="application/x-oleobject">
<param name="filename" value="/videos/<?php echo $video ?>" />
<param name="showstatusbar" value="true" />
<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="/videos/<?php echo $video ?>" width="320" height="240" autostart="false" showcontrols="true" showstatusbar="true"></embed>
</object>
</div>
?>
Just simple query and retrival of the data, nothin' more than that.
As for a video index page such as mine, it's the exact same thing, only minus the video code of course, and within a while loop.
#7
Posted 28 August 2006 - 06:15 PM
Ok heres some of the code thats is used:
MySQL Database:
player.php:
connect.php:
mysql.php:
And for the Windows Media Player Embedded for file src is:
MySQL Database:
`Vault` ( `ID` INT( 11) NOT NULL AUTO_INCREMENT PRIMARY KEY , `Name` VARCHAR( 255 ) NOT NULL , `File` VARCHAR( 255 ) NOT NULL ) TYPE = MYISAM^ Thats how the database is setup.
player.php:
<?php
include ('includes/connect.php');
?>
connect.php:
<?PHP
include("includes/mysql.php");
$request = mysql_query("SELECT ID,Name,File from Vault") or die(mysql_error());
mysql_fetch_array($request)
?>
mysql.php:
<?PHP
mysql_connect("localhost", "*******_gtvault", "*******");
mysql_select_db("*******_VideoVault");
?>
And for the Windows Media Player Embedded for file src is:
<param name="url" value="<?php echo $databaserow->File;?>">
Edited by Benny852, 28 August 2006 - 06:17 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
