Hi All,
Bit of a coding error - I'm not that experienced and self-taught from messing around with PHP so I think I've got into some bad habits and thats what's causing the problem!
My issue is; at present I've got a SQL database with a list of videos all hosted onsite, however I've recently added some videos which are hosted offsite on youtube... What I'd like to do is pull videos from the internal source but UNLESS a youtube selection has been made...
I thought the easiest way to do this would be to add two fields into my database, a value that is yes or no (to see if their is a youtube link) and the embed code to be displayed if the value is yes.
My code looks like this:
PHP Code:
<?php
$video = $_GET['video'];
?>
<?php
$data = mysql_query("SELECT * FROM video WHERE ID = '{$video}' ORDER BY added DESC") or die(mysql_error());
mysql_real_escape_string($video);
while($info = mysql_fetch_array( $data )) if ({$info['ytembed']} = yes) {
echo "<div class='video-container'>";
echo "{$info['embedcode']}";
echo "<div class='video-title'>{$info['title']}</div>";
echo "<div class='video-subtitle'>{$info['subtitle']}</div>";
echo "</div>";
} else {
echo "<div class='video-container'>";
echo "<div class=\"video-js-box\">";
echo "<video class=\"video-js\" width=\"640\" height=\"360\" controls preload poster=\"../{$info['still']}\">
<source src=\"../{$info['qtmobile']}\" type='video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"' />";
echo " <object id=\"flash_fallback_1\" class=\"vjs-flash-fallback\" width=\"640\" height=\"360\" type=\"application/x-shockwave-flash\"
data=\"http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf\">
<param name=\"movie\" value=\"http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf\" />
<param name=\"allowfullscreen\" value=\"true\" />
<param name=\"flashvars\"
value='config={\"playlist\":[\"http://www.website.com/{$info['qtmobile']}\", {\"url\": \"http://www.jameshenry.info/{$info['qtmobile']}\",\"autoPlay\":false,\"autoBuffering\":true}]}' />
<img src=\"../{$info['still']}\" width=\"640\" height=\"360\" alt=\"Poster Image\"
title=\"No video playback capabilities.\" />
</object>";
echo "</video></div>";
echo "<div class='video-title'>{$info['title']}</div>";
echo "<div class='video-subtitle'>{$info['subtitle']}</div>";
echo "<br>";
echo "<div class='back'><a href=\"./\">«back</a></div>";
echo "</div>";
}
?>
I'm getting a syntax error on line 37 at the moment, so I'm guessing my error is with this "while($info = mysql_fetch_array( $data )) if ({$info['ytembed']} = yes) { "
Any help sorting this issue out would be appreciated! Any ideas?
|