Jump to content

MySQL Data into Embed code?


andreasb

Recommended Posts

Hello,

 

I'm currently looking for a way to get MySQL data fetched from the database and into a MegaVideo embed code.

 

The code looks similar to this:

<object width="550" height="368"><param name="movie" value="http://www.megavideo.com/v/M0HDKAVB0165365895cbde2fce915952a6208b2c"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.megavideo.com/v/M0HDKAVB0165365895cbde2fce915952a6208b2c?image=http://i42.tinypic.com/20jn49z.png" type="application/x-shockwave-flash" allowfullscreen="true" width="640" height="480"></embed></object>

 

Now, I want it to be like this, and function correctly:

<object width="550" height="368"><param name="movie" value="<?php echo $mvlink; ?>"></param><param name="allowFullScreen" value="true"></param><embed src="<?php echo $mvlink; ?>" type="application/x-shockwave-flash" allowfullscreen="true" width="640" height="480"></embed></object>

 

I've already created the $mvlink variable, and it works if I try to echo it out on just a white page, but when I try it inside this code, the embeded video just shows a white "box", which means that the code is not correct.

What have I done wrong here?

Link to comment
https://forums.phpfreaks.com/topic/181326-mysql-data-into-embed-code/
Share on other sites

Not sure I'm following.  Are you asking if you can do away with the mysql query and just use php?  If so the answer is no.

 

assuming your table is called movies and your href is in a field called href, and also assuming that you have already connected to your db...

 

$query=mysql_query("SELECT href FROM movies") or die("I got this messed up code on the internet and it doesnt work: ".mysql_error());
while($fetch=mysql_fetch_array($query)
{
   $mvlink=$fetch['href'];
   echo "<object width=\"550\" height=\"368\"><param name=\"movie\" value=\"".$mvlink."\"></param><param name=\"allowFullScreen\" value=\"true\"></param><embed src=\"".$mvlink."\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"640\" height=\"480\"></embed></object>\n" ;
}//end while loop

 

That will cycle through every row of your db and put in the object defined on each row.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.