Current time: 04-23-2014, 01:01 AM Hello There, Guest! (LoginRegister)

Post Reply 
Using a while loop for videos (MYSQL AND PHP)
04-05-2011, 09:33 AM
Post: #1
Using a while loop for videos (MYSQL AND PHP)
I am using a mysql database to sent out a playlist page to the user. For instance, "playlist.php". This php file contains an image with a link attached that when click will take the user to another php file titled "videos.php". Then based on my _GET I retrieve which video was selected on the previous page by its ID number. This is located in the browser's url bar as http://website.com/videos.php?v=$id
v is the _GET variable that is being looked for, and the $id just stands for the value of the video's id that was from the previous page.

How would I code this into a while loop so each page would have a specific window with only that video in that player on the following page (videos.php).

This is what I have so far. Please points out any possible issues.

I am using the code for windows media player because the url is to a wmv file.

PHP Code:
<?php

// connect and mysql include
require("connect.php");

$id $_GET['v'];
$query mysql_query("SELECT url FROM sdplaylist ORDER BY id LIMIT 1");

$numrows mysql_num_rows($query);

while (
$row mysql_fetch_assoc($query);)
{
$id $row['id'];
$url $row['url'];
?>
<OBJECT id='mediaPlayer1' width="180" height="50"
classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'
codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>
<param name='fileName' value="<?php echo "$url";?>">
<param name='animationatStart' value='true'>
<param name='transparentatStart' value='true'>
<param name='autoStart' value="false">
<param name='showControls' value="true">
<param name ="ShowAudioControls"value="true">
<param name="ShowStatusBar" value="true">
<param name='loop' value="false">
<EMBED type='application/x-mplayer2'
pluginspage='http://microsoft.com/windows/mediaplayer/en/download/'
id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1'
bgcolor='darkblue' showcontrols="true" showtracker='-1'
showdisplay='0' showstatusbar='-1' videoborder3d='-1' width="420" height="380"
src="<?php echo "$url";?>" autostart="true" designtimesp='5311' loop="false">
</EMBED>
</OBJECT>
<?php
}


?>


Thank you for your time.
Mike
Find all posts by this user
Quote this message in a reply
04-06-2011, 11:33 AM
Post: #2
RE: Using a while loop for videos (MYSQL AND PHP)
Anyone? If you need more information, just ask. I really would like to finish this project.
Find all posts by this user
Quote this message in a reply
05-01-2011, 03:20 PM
Post: #3
RE: Using a while loop for videos (MYSQL AND PHP)
PHP Code:
$query mysql_query("SELECT url FROM sdplaylist WHERE id='$id'"); 

Selecting by id will give you the desired results.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: