<?php
//Retrieves data from MySQL
mysql_connect("localhost", "root", "") or die ("Could not save image name Error: " . mysql_error());
mysql_select_db("v1") or die("Could not select database");
$data = mysql_query("SELECT `URL` FROM video ") or
die(mysql_error());
//Puts it into an array
$file_path = 'http://localhost/img_uploaddd/videos/';
while($row = mysql_fetch_assoc( $data ))
{//Outputs the image and other data
$src=$file_path.$row['URL'];
?>
<script src="includes/swfobject.js" type="text/javascript"></script>
<div id="flvplayer"></div>
<script type="text/javascript">
var so = new SWFObject("mpw_player.swf", "swfplayer", "400", "327", "9", "#000000"); // Player loading
so.addVariable("flv", "<?php echo $src ;?>"); // File Name
so.addVariable("jpg","trusted.jpg"); // Preview photo
so.addVariable("autoplay","false"); // Autoplay, make true to autoplay
so.addParam("allowFullScreen","true"); // Allow fullscreen, disable with false
so.addVariable("backcolor","000000"); // Background color of controls in html color code
so.addVariable("frontcolor","ffffff"); // Foreground color of controls in html color code
so.write("flvplayer"); // This needs to be the name of the div id
</script>
}?>
1 Replies - 275 Views - Last Post: 24 July 2012 - 10:43 PM
#1
how can retrive videos in the databse using path?
Posted 24 July 2012 - 10:30 PM
Replies To: how can retrive videos in the databse using path?
#2
Re: how can retrive videos in the databse using path?
Posted 24 July 2012 - 10:43 PM
First of all I don't think you want your <script src="includes/swfobject.js"> tag stuff being inside the loop. You wouldn't want to link the Javascript file into the page for each row of the table. It should be linked once and then it can be used for all.
Secondly, you don't want to be creating divs for each row that have the same id name "flvplayer". Remember IDs are suppose to be unique. You may need to come up with a way to tack on something like a number to make sure each div has a unique name and then adjust the name in your last so.write() statement.
Third, you might want to surround your $src variable with double quotes so that it resolves the variable name....
The double quotes here say look through the string for variables and resolve them to their value.
Try some of these changes and you might get it working.
Secondly, you don't want to be creating divs for each row that have the same id name "flvplayer". Remember IDs are suppose to be unique. You may need to come up with a way to tack on something like a number to make sure each div has a unique name and then adjust the name in your last so.write() statement.
Third, you might want to surround your $src variable with double quotes so that it resolves the variable name....
so.addVariable("flv", '<?php echo "$src"; ?>');
The double quotes here say look through the string for variables and resolve them to their value.
Try some of these changes and you might get it working.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|