Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/02/2012, 12:32
StevenLlaja
 
Fecha de Ingreso: mayo-2011
Mensajes: 15
Antigüedad: 13 años
Puntos: 0
Problema con consulta MySql y PHP

Buneas tardes, tengo un problema con mi siguiente código:
Código PHP:
<?php

 $id
=$_GET["cod"];
       
$consulta="SELECT af.idalbum AS idalbum, af.nombre_album as album,af.fecha_creacion AS fecha, a.ruta_foto as ruta
FROM album_fotos af
INNER JOIN fotos a ON
af.idalbum=a.idalbum
WHERE af.idalbum=$id"
;
       
$result=mysql_query($consulta,$conexion);

       if(!
$result){
           die(
'Consulta invalida 1: '.mysql_error());
       }
       else{
           
$contador=mysql_num_rows($result);
           if(
$contador==1){
               while(
$row=mysql_fetch_array($result)){ ?>
                   
                  
                   <table width="578" height="138" border="1">
                   <form method="post"action="album_nro.php">
    <tr >

<td width="566" valign="top"><p><font size=3 color="darkred"><b><h3>ALBUM:<?php echo $row['album']; ?></h3></b></font>
 
                       <p><b>Publicado el </b><?php echo $row['fecha']; ?><br>
     
                      
                           <?php
                   $fotourl
=$row['ruta'];
 
$ruta="imagenes/eventos/";
 
$ruta=$ruta.$fotourl;
 
//echo $ruta 
                   
echo "<br><br><img src=".$ruta." width=500 height=300 align=\"center\" ><br><br>";
?>
                   <input type="hidden" name="cod" value="<?php echo $row['idalbum']; ?>"> 
           
                    </p></tr>
                           </form>
   </table><?php }
   }
           }
?>
         <p><br>
         </p>
        </td></tr>
       </table>
Esta parte de mi página ha sido direccionada desde una lista de album, el punto es que debería mostrarme las fotos en la que están ese album.

El error que me manda es en la consulta, exactamente en la línea 5 de ésta, es decir en el WHERE.

No encuentro la solución al problema, ya que el id me direcciona correctamente, pero no muestra las fotos, mostrando ese error.

Espero puedan apoyarme. Saludos.