Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/12/2009, 14:22
albertrc
 
Fecha de Ingreso: febrero-2009
Mensajes: 443
Antigüedad: 16 años
Puntos: 1
Problemas con <img src="./imagenes/<?php echo $foto; ?>">

CREATE TABLE IF NOT EXISTS foto (
id_foto SMALLINT(4) UNSIGNED ZEROFILL NOT NULL,
nombre_foto VARCHAR(50) UNIQUE NOT NULL,
foto VARCHAR(150) UNIQUE NOT NULL,
categoria_foto VARCHAR(50) NOT NULL,
formato_foto VARCHAR(50) NOT NULL,
foto_id_producto SMALLINT (3) UNSIGNED ZEROFILL NOT NULL,
CONSTRAINT pk_id_foto PRIMARY KEY (id_foto),
)ENGINE=InnoDB;

insert
id_foto nombre_foto foto categoria_foto format_foto foto_id_producte
0000 tocinet /var/www/html/php/imagenes reposteria image/jpeg 000

indice.html
<li><a href="foto.php?id_foto=0000">foto tocinet</a></li>

photo.php
$link = mysqli_connect($hostname,$user,$password,$database );
$query = "select foto from foto where id_foto= $_GET[id_foto] ";
$result = mysqli_query($link, $query);

/* associative array */
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
?> <img src=imagenes <?php echo "{$row['foto']} /> <?php <br>\n";


}

/* free result set */
mysqli_free_result($result);

/* close connection */
mysqli_close($link);
?>

indice i foto estan en la carpeta php
i las imagenes en la capreta imagenes