Cita:
Iniciado por cabritillo77
Hola pithon. Me imagino que lo que estas tratando de hacer es trabajar con esas imagenes y publicarlas posteriormente.
Te dejo un script por si te pudiera servir:
Código PHP:
// armamos la consulta
$sqlQueryNot = mysql_query("SELECT not_ID, notTitulo, notTexto, foto, link FROM sn_noticias where notCategoriaID='1' ORDER BY not_ID DESC LIMIT 4", $db_link) or die(mysql_error);
//Declarar el array
$Arrayfoto = array(foto);
while($rowNot = mysql_fetch_array($sqlQueryNot)){
$Arrayfoto[]= $rowNot[foto];
}
Aqui lo que haces es obtener todas las iagenes en un array. Luego para publicarlas:
Código PHP:
<a href="nombre_carpeta/<? echo $Arrayfoto[1]; ?>"><img src="nombre_carpeta/<? echo $Arrayfoto[1]; ?>" width="85" height="85"></a><br><br>
<a href="nombre_carpeta/<? echo $Arrayfoto[2]; ?>"><img src="nombre_carpeta/<? echo $Arrayfoto[2]; ?>" width="85" height="85"></a><br><br>
<a href="nombre_carpeta/<? echo $Arrayfoto[3]; ?>" id="1"><img src="nombre_carpeta/<? echo $Arrayfoto[3]; ?>" width="85" height="85"></a><br><br>
<a href="nombre_carpeta/<? echo $Arrayfoto[4]; ?>"><img src="nombre_carpeta/<? echo $Arrayfoto[4]; ?>" width="85" height="85"></a><br><br>
Espero te sirva
Supongo que te das cuenta de la burrada de código innecesario que usas ¿No?
¿Para qué declaras un array?
mysql_fetch_array() Devuelve un array por posición(índice) y como el fetch_assoc otro asociativo.
Por tanto cuando haces el while sólo tienes que hacer un echo <a href> y el <img> y mostrar los datos.
Código PHP:
while($row = mysql_fetch_array($sql))
echo '<a href="nombre_carpeta/'.$row ['nombre'].'"><img src="nombre_carpeta/'.$row ['nombre'].'"></a>';

Anda 2 líneas... ¿De verdad trabajan así con php?

Será que les gusta tener mil arrays