Jump to content
Sign in to follow this  
diabolickman

Incorporação youtube com php

Recommended Posts

diabolickman

Boas.

Pela primeira vez estou a tentar usar videos do youtube + php. Tenho os links guardados numa base de dados. vejamos o código:

     <?php
		   $db=mysql_connect("localhost","root","");
				if (!$db){
					die('Não foi possível conectar á Base de Dados' . mysql_error());
				}
			mysql_select_db("portolio");
			$query="SELECT `video_id` FROM `youtube`";
			$result=mysql_query($query,$db) or die ("bad operation" . mysql_error());
			$nreg = mysql_affected_rows(); //basicamente é o numero de id
			$id = 1;
			while($id <= $nreg){
				$query="SELECT * FROM `youtube` WHERE `video_id`='$id'"; //&& `galeria`='principal'
				$result=mysql_query($query,$db) or die ("bad operation" . mysql_error());
				$array_resultado=mysql_fetch_array($result);
				$nome=$array_resultado['nome'];
				$descricao=$array_resultado['descricao'];
				$link=$array_resultado['link'];
				$id +=1;
				echo '<iframe width="480" height="390" src="'.$link.'" frameborder="1" allowfullscreen></iframe>';
			}
			mysql_close($db); ?>

Ele imprime as iframe correctas, com o código correcto, só que não funciona, fica assim:

semttulofk.png

Alguém tem alguma sugestão?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. 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.