btborges Posted November 11, 2013 Share Posted November 11, 2013 how can I solve this <?php include('admin/panel/_setup.php'); ?> <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title>Mis galerias</title> <link rel="stylesheet" href="website.css" /> </head> <body> <div id="principal"> <?php if( isset( $_GET['gal'] ) ) { $id = $_GET['gal']; $consulta = "SELECT DESCRIPCION, TITULO FROM galerias WHERE IDGALERIA='$id'"; $filas = mysqli_query($cnx, $consulta); $col = mysqli_fetch_assoc($filas); echo "<h2>$col[TITULO]</h2>"; echo "<p>$col[DESCRIPCION]</p>"; echo '<div id="ver_galeria">'; $consulta = "SELECT * FROM FOTOS WHERE FKGALERIA='$id' AND ESTADO='visible' ORDER BY POSICION"; $filas = mysqli_query($cnx, $consulta); while( $col = mysqli_fetch_assoc($filas)){ echo '<div>'; echo '<p>'.$col['NOMBRE'].'</p>'; echo '<img src="admin/fotos/'.$col['ARCHIVO'].'" alt="'.$col['NOMBRE'].'" />'; echo '</div>'; } echo '</div>'; }else{ $consulta =<<<SQL SELECT IDGALERIA, TITULO, DESCRIPCION, DATE_FORMAT( FECHA_ALTA, '%d/%m/%y' ) FECHA FROM galerias ORDER BY FECHA_ALTA DESC SQL; $filas = mysqli_query( $cnx, $consulta ); echo '<div id="listado">'; while( $columna = mysqli_fetch_assoc($filas)){ $id = $columna['IDGALERIA']; $subconsulta = "SELECT ARCHIVO FROM fotos WHERE FKGALERIA='$id' AND ESTADO='visible' ORDER BY RAND() LIMIT 1"; $filas2 = mysqli_query($cnx, $subconsulta); $datos = mysqli_fetch_assoc($filas2); $nombre_archivo = $datos['ARCHIVO']; echo '<div>'; echo "<h2>$columna[TITULO]</h2>"; echo "<div>$columna[FECHA]</div>"; if( $nombre_archivo != null){ echo "<img src='admin/fotos/$nombre_archivo' alt='preview de la galeria' />"; } echo "<p>$columna[DESCRIPCION]</p>"; echo "<a href='index.php?gal=$columna[IDGALERIA]'>VER GALERIA</a>"; echo '</div>'; } echo '</div>'; } ?> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
Barand Posted November 11, 2013 Share Posted November 11, 2013 see FAQ http://forums.phpfreaks.com/index.php?act=findpost&pid=1428660 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.