Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/05/2011, 18:53
cabritillo77
 
Fecha de Ingreso: mayo-2011
Mensajes: 33
Antigüedad: 13 años
Puntos: 4
[problema] mostrar 6 imagenes a la vez

Tengo el siguiente codigo para mostrar imagenes de una base de datos:

(Guardo las URL de 6 imagenes en la base de datos junto con un titulo de evento y las jpg en el host)

El problema es que segun esta escrito el codigo me muestra 6 lineas con 1 foto en cada linea y cada una con su titulo. Es decir tengo 6 lineas con 6 fotos y 6 titulos

Mi idea es que me muestre solo 1 vez el titulo y las 6 fotos en una sola linea bajo el titulo. Espero haberme explicado bien.

imagenesr2011.php
Código PHP:
<?
include_once"db-cnx.php";
if(isset(
$_GET['enviar'])){
    
// asignamos los valores
    // a las variables que usaremos
    
$tituloevento $_GET['tituloevento'];
    
}
$sqlevento mysql_query("SELECT * FROM eventos order by eventos.tituloevento DESC"$db_link) or die(mysql_error);

if (
mysql_num_rows($sqlevento)) {
while(
$evento mysql_fetch_array($sqlevento)){
    
echo
'

<body bgcolor="#FFE821">
<center>
<font color="steelblue"><b>FOTOS DE ACTOS,CAMPEONATOS Y EQUIPOS</b></FONT>
</center>
<HR size="5" COLOR="NAVY">
<table>
<tr>
<td>'
.$evento[tituloevento].'</td>
</tr>
<tr>
<td>
<a href="imagesr2011/'
.$evento[fotos].'"><img src="imagesr2011/'.$evento[fotos].'"
width="100" height="100"></a>
</td>
</tr>
</table>
 
<HR size="5" COLOR="NAVY">'
;

}
} else {
    echo 
"No hay eventos para mostrar";
}
?>

El script que uso para subir las imagenes es el siguiente:

evento_imagen.php

Código PHP:
<?php 

include ('db-cnx.php'); 
if(isset(
$_POST['enviar']) && $_POST['enviar'] == 'Enviar'){ 
     
if(!empty(
$_POST['tituloevento'])){ 

            
$tituloevento $_POST['tituloevento'];     
$tituloevento strtoupper ($tituloevento); 
$date date("d-m-Y-H-i-s");
foreach (
$_FILES["foto"]["error"] as $key => $error) { 
    
//Lo de abajo significa si se sube correctamente//
    
if($error== UPLOAD_ERR_OK){ 
        
$nombre_archivo $_FILES["foto"]["name"][$key];   
$tipo_archivo $_FILES["foto"]["type"][$key];   
$tamano_archivo $_FILES["foto"]["size"][$key]; 
$temp_archivo $_FILES["foto"]["tmp_name"][$key]; 


if (!((
strpos($tipo_archivo"gif") || strpos($tipo_archivo"jpeg")) && (    $tamano_archivo 1000000)))  
{   
    echo 
"La extensión o el tamaño de los archivos no es correcta. <br><br><table><tr><td><li>Se permiten archivos .gif o .jpg<br><li>se permiten archivos de 1Mg máximo.</td></tr></table>"

else  
{   
    
$nom_img $nombre_archivo;  
      
    
$directorio 'imagesr2011/'
    if (
move_uploaded_file($temp_archivo,$directorio "/" $nom_img))  
    { 
     

            
           
// hacemos el INSERT en la BD 
$sqlInsertNot mysql_query("INSERT INTO eventos 
(tituloevento, fotos, fecha) 
VALUES ('$tituloevento', '$nom_img','$date')"

$db_link) or die(mysql_error()); 
  
 echo 
"Las fotos se publicaron correctamente"
}  



 }   
    }else{ 
    echo 
"Debe rellenar los campos vacios"

         } 
         
         
         
         


    

else{
$query mysql_query("SELECT * FROM eventos WHERE tituloevento='$tituloevento' ORDER BY ideventos DESC");
if (
mysql_num_rows($query)) {
    while (
$evento mysql_fetch_array($query)) { 
    echo
'

<p>Galeria Imagenes
<body bgcolor="#FFE821">
<div style="position: absolute; left: 80; top: 240">
<center>
<font color="steelblue"><b>FOTOS DE ACTOS,CAMPEONATOS Y EQUIPOS</b></FONT>
</center>
<HR size="5" COLOR="NAVY">
<table>
<caption align="top">'
.$evento['tituloevento'].'</caption>

<tr>
<td>
<a href="imagesr2011/'
.$evento['foto'].'"><img src="imagesr2011/'.$evento['foto'].'"
width="100" height="100"></a>
</td>
</tr>
 </table>
 
<HR size="5" COLOR="NAVY">


</div>
</body>'
;
    }
}else{
    echo 
"No hay eventos para mostrar";
}
mysql_free_result($evento); //Se borran los datos usados
}

?>  
<html> 
<head> 
<title>SISTEMA DE GESTION DE IMAGENES CLUB DE TENIS TORREVIEJA</title> 
</head> 
<H3>SISTEMA DE GESTION DE IMAGENES CLUB DE TENIS TORREVIEJA</H3> 

<h5><font color="red">***SOLO ARCHIVOS JPG O GIF, Y QUE SEAN MENORES A 1 Mg***</font></h5>
<form name="evento" action="<?php $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> 
<body bgcolor="#FFE821"> 
<p> 
Nombre del Evento para las imagenes<br /> 
<input type="text" name="tituloevento" size="60" /> 
</p> 
<p> 
Inserta imagenes<br /> 
<input type="file" name="foto[]" size="50" /> <BR> 
<input type="file" name="foto[]" size="50" /> <BR>
<input type="file" name="foto[]" size="50" /> <BR>
<input type="file" name="foto[]" size="50" /> <BR>
<input type="file" name="foto[]" size="50" /> <BR>
<input type="file" name="foto[]" size="50" /> <BR>

</p> 

<p> 
<input type="submit" name="enviar" value="Enviar" /> 
</p> 
</form> 

<a href="imagenesr2011.php">VER IMAGENES</a> 
</body> 
</html>
Un saludo y gracias por la ayuda