andreasb Posted November 12, 2009 Share Posted November 12, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/181326-mysql-data-into-embed-code/ Share on other sites More sharing options...
eugene2009 Posted November 13, 2009 Share Posted November 13, 2009 Your getting this out of your mysql database right? Quote Link to comment https://forums.phpfreaks.com/topic/181326-mysql-data-into-embed-code/#findComment-956534 Share on other sites More sharing options...
andreasb Posted November 13, 2009 Author Share Posted November 13, 2009 Uhm .. Yes. This is what's in the database, I just want to be able to fetch it with PHP instead: http://www.megavideo.com/v/M0HDKAVB0165365895cbde2fce915952a6208b2c Quote Link to comment https://forums.phpfreaks.com/topic/181326-mysql-data-into-embed-code/#findComment-956679 Share on other sites More sharing options...
defeated Posted November 13, 2009 Share Posted November 13, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/181326-mysql-data-into-embed-code/#findComment-956744 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.