Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/11/2014, 05:51
Avatar de maiksix
maiksix
 
Fecha de Ingreso: noviembre-2014
Ubicación: Sabadell
Mensajes: 124
Antigüedad: 9 años, 5 meses
Puntos: 1
Youtube video player

Buenas a todos!

Llevo unos días trasteando varios códigos para poner un reproductor de youtube en mi web. En la BD tengo una de los campos que es la url (tipo varchar, longitud de 500 chars).

El problema esta en que ninguno de los siguientes códigos muestra el reproductor. Solo muestran un recuadro negro o blanco... He comprobado con el "inspeccionar elemento" de Chrome y sale la url correctamente pero no va...

Alguna idea? Aquí os dejo los códigos que he probado...

Código:
<table style="width:1024px; margin-top:30px;">
<tr>
<?php
$consulta = "SELECT *
FROM videos
ORDER BY fecha desc
LIMIT 3";
        $result = mysql_query($consulta,$con);
         while($row = mysql_fetch_array($result)){
         echo "<td style='float:left'><iframe width='420' height='315'
         src='".$row['url']."'></iframe></td>";
                                                    }
        ?>
</tr>
        
</table>
Código:
<table style="width:1024px; margin-top:30px;">
<tr>
<?php
$consulta = "SELECT *
FROM videos
ORDER BY fecha desc
LIMIT 3";
        $result = mysql_query($consulta,$con);
         while($row = mysql_fetch_array($result)){
         echo "<td style='float:left'> <object width="420" height="315"
data='".$row['url']."'>
</object></td>";
                                                    }
        ?>
</tr>
        
</table>
Código:
<table style="width:1024px; margin-top:30px;">
<tr>
<?php
$consulta = "SELECT *
FROM videos
ORDER BY fecha desc
LIMIT 3";
        $result = mysql_query($consulta,$con);
         while($row = mysql_fetch_array($result)){
         echo "<td style='float:left'> <embed width="420" height="315"
src='".$row['url']."'></td>";
                                                    }
        ?>
</tr>
        
</table>
También probé añadiendo esto (type="application/x-shockwave-flash") en el último código, quedando así:

Código:
<table style="width:1024px; margin-top:30px;">
<tr>
<?php
$consulta = "SELECT *
FROM videos
ORDER BY fecha desc
LIMIT 3";
        $result = mysql_query($consulta,$con);
         while($row = mysql_fetch_array($result)){
         echo "<td style='float:left'> <embed width="420" height="315"
src='".$row['url']."' type="application/x-shockwave-flash"></td>";
                                                    }
        ?>
</tr>
        
</table>
Ojala podáis echarme un cable o algo... porque he buscado alternativas pero solo encuentro estas 4...

Muchas gracias :)
__________________
Going hard for too long... Can't get enough