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

 

 

Link to comment
Share on other sites

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.