Jump to content

Recommended Posts

How i can do it ? if i echo  the embed whole (with address to ) its work fine (althought i dont want it!)

 

but if i put the url in a variable  it doesnt work  like this :

 

<?php 
$s = "http://www.youtube.com/watch?v=_i2MSvaZeqw";

echo "<object type=\"application/x-shockwave-flash\" style=\"width:425px; height:350px;\" data=\"".$s."\"><param name=\"movie\" value=\"".$s."\" /></object>" ;
?>

Link to comment
https://forums.phpfreaks.com/topic/52976-embedding-youtube-video-via-php/
Share on other sites

it's created a parsing error

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/other/db2student/labdb219/public_html/asdf.php on line 20

 

line 20 is the  echo"code for embedding youtube";

 

do i have to do something on $s?

<?php 
$con = mysql_connect("localhost","labdb2_19","2004040");
			if (!$con)
		    {
	  			die('Could not connect: ' . mysql_error());
	  		}
			mysql_select_db("labdb2_19", $con);
	  		$sql = "SELECT youtube FROM movie WHERE title ='Spider-man3'";
	  		$result = mysql_query($sql);
			while ($row = mysql_fetch_assoc($result)) 
			{
				echo "<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"$row['youtube']\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"$row['youtube']\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed></object> ";

			}

			mysql_free_result($result);
			mysql_close($con);

?>

 

its the whole code in the page (nothing else)

 

result from putty http://195.251.111.53/~labdb219/putty.JPG

<?php 
$con = mysql_connect("localhost","labdb2_19","2004040");
			if (!$con)
		    {
	  			die('Could not connect: ' . mysql_error());
	  		}
			mysql_select_db("labdb2_19", $con) or die(mysql_error());
	  		$sql = "SELECT youtube FROM movie WHERE title ='Spider-man3'";
	  		$result = mysql_query($sql) or die(mysql_error());
			while ($row = mysql_fetch_assoc($result)) 
			{
				echo "<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"$row['youtube']\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"$row['youtube']\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed></object>";

			}

			mysql_free_result($result);
			mysql_close($con);

?>

 

Added a bit of debugging.

Silly me. Didn't spot that you missed out your final } brace!

 

<?php 
$con = mysql_connect("localhost","labdb2_19","2004040");
			if (!$con)
		    {
	  			die('Could not connect: ' . mysql_error());
	  		}
			mysql_select_db("labdb2_19", $con) or die(mysql_error());
	  		$sql = "SELECT youtube FROM movie WHERE title ='Spider-man3'";
	  		$result = mysql_query($sql) or die(mysql_error());
			while ($row = mysql_fetch_assoc($result)) 
			{
				echo "<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"$row['youtube']\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"$row['youtube']\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"350\"></embed></object>";

			}

			mysql_free_result($result);
			mysql_close($con);

		    }

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.