07/9/09
preguntaPor: FLORENCIAHola como se puede hacer para que dentro de una misma pagina se carguen 3 imagenes diferentes...yo hice una base de datos las cuales tienen 3 campos foto1 es uno con un char de 3, foto2 es lo mismo ya q tiene igual la extencion y foto3, pero cuando voy a la pagina y aplico el codigo php solo me carga 1 imagen....como puede ser? les pego el codigo para q vean del abm a ver si esta mal eso
<?php
if($_POST["guardar"]){
mysql_connect("localhost", "root", "" );
mysql_select_db("solyde_solydeus");
$imagen=pathinfo($_FILES["foto_h"]["name"]);
$imagen2=pathinfo($_FILES["foto_h1"]["name"]);
$imagen3=pathinfo($_FILES["foto_h2"]["name"]);
$imagen=$imagen["extension"];
$imagen2=$imagen2["extension"];
$imagen3=$imagen3["extension"];
mysql_query("insert into home (titulo_h, titulo_h_2, titulo_h_3, descripcion_corta, descripcion_corta_2, descripcion_corta_3, foto_h, foto_h1, foto_h2)
values('$_POST[titulo_h]', '$_POST[titulo_h_2]', '$_POST[titulo_h_3]', '$_POST[descripcion_corta]', '$_POST[descripcion_corta_2]', '$_POST[descripcion_corta_3]', '$imagen', '$imagen2', '$imagen3')");
move_uploaded_file($_FILES["foto_h"]["tmp_name"],
mysql_insert_id() .".". $imagen);
header("location:index.php");
move_uploaded_file($_FILES["foto_h1"]["tmp_name"],
mysql_insert_id() .".". $imagen2);
header("location:index.php");
move_uploaded_file($_FILES["foto_h2"]["tmp_name"],
mysql_insert_id() .".". $imagen3);
header("location:index.php");
}
?>
<html>
<head>
<link href="../proyecto_flor/estilos.css" rel="stylesheet" type="text/css">
<script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<link href="../estilo.css" rel="stylesheet" type="text/css">
<body>
<form method="post" action="noticias.php" enctype="multipart/form-data">
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><table width="780" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="77" colspan="2"><table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10"> </td>
<td width="300"><img src="../imagenes/logo.jpg" width="198" height="77" /></td>
<td width="460" height="77" align="right" valign="middle"><img src="../imagenes/ideasysol.jpg" width="180" height="70" /></td>
<td width="10"> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="25" colspan="2" background="../imagenes/barra-menu.jpg"><table width="780" border="0" cellpadding="0" cellspacing="0" class="menu">
<tr>
<td width="10" height="25"> </td>
<td width="760" height="25" align="center" valign="middle"><a href="../index.htm" class="menua">INICIO</a><span class="menua"> | <a href="../historia.htm">HISTORIA</a> | <a href="../filosofia.htm">FILOSOFIA</a> | <a href="../quienes_somos.htm">QUIENES SOMOS</a> | <a href="../muestras.htm">MUESTRAS</a> | <a href="../empresas.htm">EMPRESAS E INSTITUCIONES</a> | <a href="../noticias.htm">NOTICIAS</a> | <a href="../contacto.htm">CONTACTO</a></span></td>
<td width="10" height="25"> </td>
</tr>
</table></td>
</tr>
<tr>
<td width="780" height="200" colspan="2"> <span class="textobold"> NOTICIA 1<br>
</span>
<table border="4" bgcolor="#e5e5e5" align="center" class="formulario">
<tr>
<td class="textobold"> Titulo
<input type="text" name="titulo_h" size="100" class="formulario"> </td>
</tr>
<tr>
<td class="textobold"> Texto
<textarea name="descripcion_corta" cols="97" rows="5" class="formulario"></textarea> </td>
</tr>
<tr>
<td class="textobold"> Foto
<input type="file" name="foto_h" size="100" class="formulario" id="foto_h"> </td>
</tr>
</table>
<br>
<span class="textobold"> NOTICIA2<br>
</span>
<table border="4" bgcolor="#e5e5e5" align="center" class="formulario">
<tr>
<td class="textobold"> Titulo
<input type="text" name="titulo_h_2" size="100" class="formulario"> </td>
</tr>
<tr>
<td class="textobold"> Texto
<textarea name="descripcion_corta_2" cols="97" rows="5" class="formulario"></textarea> </td>
</tr>
<tr>
<td class="textobold"> Foto
<input type="file" name="foto_h1" size="100" class="formulario" id="foto_h1"> </td>
</tr>
</table>
<br>
<span class="textobold"> NOTICIA3<br>
</span>
<table border="4" bgcolor="#e5e5e5" align="center" class="formulario">
<tr>
<td class="textobold"> Titulo
<input type="text" name="titulo_h_3" size="100" class="formulario"> </td>
</tr>
<tr>
<td class="textobold"> Texto
<textarea name="descripcion_corta_3" cols="97" rows="5" class="formulario"></textarea> </td>
</tr>
<tr>
<td class="textobold"> Foto
<input type="file" name="foto_h2" size="100" class="formulario" id="foto_h2"> </td>
</tr>
</table>
<div align="right">
<input type="submit" name="guardar" value="Guardar" id="guardar">
</div>
<br>
<br></td>
</tr>
<tr>
<td colspan="2"><table width="780" border="0" cellspacing="0" cellpadding="0">
<tr> </tr>
</table></td>
</tr>
<tr>
<td colspan="2"><table width="780" border="0" cellspacing="0" cellpadding="0">
<tr> </tr>
</table>
<img src="../imagenes/linea.jpg" width="780" height="2" /></td>
</tr>
<tr class="borde">
<td height="20" class="pie"> Solydeus.org © 2009. Todos los derechos reservados.</td>
<td height="20" class="arialgrispie"><div align="right"><a href="http://p-opuestos.com/">Diseño: PolosOpuestos </a></div></td>
</tr>
</table></td>
</tr>
</table>
<br>
</form>
</body>
</head>
</html>
y este es el codigo del archivo al cual tienen que subir
<?php
mysql_connect("localhost", "root", "");
mysql_select_db("solyde_solydeus");
$q=mysql_query("select * from home");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Fundación Solydeus</title>
<style type="text/css">
<!--
body {
background-color: #999999;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
left: 0px;
top: 0px;
right: 0px;
bottom: 0px;
}
-->
</style>
<link href="../estilo.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="420" valign="top"><table width="780" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="77" colspan="2"><table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10"> </td>
<td width="300"><img src="../imagenes/logo.jpg" width="198" height="77" /></td>
<td width="460" height="77" align="right" valign="middle"><img src="../imagenes/ideasysol.jpg" width="180" height="70" /></td>
<td width="10"> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="25" colspan="2" background="../imagenes/barra-menu.jpg"><table width="780" border="0" cellpadding="0" cellspacing="0" class="menu">
<tr>
<td width="10" height="25"> </td>
<td width="760" height="25" align="center" valign="middle"><a href="../index.htm" class="menua">INICIO</a><span class="menua"> | <a href="../historia.htm">HISTORIA</a> | <a href="../filosofia.htm">FILOSOFIA</a> | <a href="../quienes_somos.htm">QUIENES SOMOS</a> | <a href="../muestras.htm">MUESTRAS</a> | <a href="../empresas.htm">EMPRESAS E INSTITUCIONES</a> | <a href="../noticias.htm">NOTICIAS</a> | <a href="../contacto.htm">CONTACTO</a></span></td>
<td width="10" height="25"> </td>
</tr>
</table></td>
</tr>
<tr>
<td width="780" height="200" colspan="2"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','780','height','200','src','../imagenes/top','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../imagenes/top' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="780" height="200">
<param name="movie" value="../imagenes/top.swf" />
<param name="quality" value="high" />
<embed src="../imagenes/top.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="780" height="200"></embed>
</object></noscript>
<br />
<br /></td>
</tr>
<tr>
<td colspan="2"><table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10"> </td>
<td width="760"><table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="118"><img src="../imagenes/1.jpg" width="118" height="122" border="0" usemap="#Map" /></td>
<td width="10"> </td>
<td width="118"><img src="../imagenes/2.jpg" width="118" height="122" border="0" usemap="#Map2" /></td>
<td width="10"> </td>
<td width="118"><img src="../imagenes/3.jpg" width="118" height="122" border="0" usemap="#Map3" /></td>
<td width="10"> </td>
<td width="118"><img src="../imagenes/4.jpg" width="118" height="122" border="0" usemap="#Map4" /></td>
<td width="10"> </td>
<td width="118"><img src="../imagenes/5.jpg" width="118" height="122" border="0" usemap="#Map5" /></td>
<td width="10"> </td>
<td width="118"><img src="../imagenes/6.jpg" width="118" height="122" border="0" usemap="#Map6" /></td>
</tr>
</table></td>
<td width="10"> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="25" colspan="2"><table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10" colspan="7"><table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="img/agenda-copia.jpg" width="780" height="100" /></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="7"><img src="../imagenes/linea.jpg" width="780" height="2" /><br /><br /></td>
</tr>
<tr>
<?PHP
while ($f=mysql_fetch_array($q)){
?>
<td width="11" rowspan="2"> </td>
<td width="242"><img width="220" height="187" src="<?PHP echo ($f["idHome"]); ?>.<?php echo ($f["foto_h"]);?>"></td>
<td width="11"> </td>
<td><img width="220" height="187" src="<?PHP echo ($f["idHome"]); ?>.<?php echo ($f["foto_h1"]);?>"></td>
<td width="11" rowspan="2" align="left" valign="top"> </td>
<td width="221" valign="top"><img width="220" height="187" src="<?PHP echo ($f["idHome"]); ?>.<?php echo ($f["foto_h2"]);?>" /></td>
<td width="31" rowspan="2"> </td>
</tr>
<tr>
<td width="242" valign="top" class="texto"><br />
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="textobold">
<tr>
<td><?php echo ($f["titulo_h"]);?></td>
</tr>
</table>
<br />
<?php echo ($f["descripcion_corta"]);?></td>
<td width="11"> </td>
<td height="187" valign="top" class="texto"><br />
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="textobold">
<tr>
<td><?php echo ($f["titulo_h_2"]);?></td>
</tr>
</table>
<br />
<?php echo ($f["descripcion_corta_2"]);?></td>
<td width="221" valign="top" class="texto"><br />
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="textobold">
<tr>
<td><?php echo ($f["titulo_h_3"]);?></td>
</tr>
</table>
<br />
<?php echo ($f["descripcion_corta_3"]);?></td>
</tr>
<?PHP
}
?>
</table>
<img src="../imagenes/linea.jpg" width="780" height="2" /></td>
</tr>
<tr class="borde">
<td height="20" class="pie"> Solydeus.org © 2009. Todos los derechos reservados.</td>
<td height="20" align="right" class="arialgrispie"><a href="http://p-opuestos.com/">Diseño: PolosOpuestos </a></td>
</tr>
</table></td>
</tr>
</table>
<map name="Map10" id="Map10">
<area shape="rect" coords="2,1,149,182" href="../noticias_niño.htm" />
</map>
<map name="Map" id="Map"><area shape="rect" coords="1,3,114,119" href="../historia.htm" />
</map>
<map name="Map2" id="Map2"><area shape="rect" coords="3,4,117,120" href="../filosofia.htm" />
</map>
<map name="Map3" id="Map3"><area shape="rect" coords="5,3,119,119" href="../quienes_somos.htm" />
</map>
<map name="Map4" id="Map4"><area shape="rect" coords="2,3,116,120" href="../muestras.htm" />
</map>
<map name="Map5" id="Map5"><area shape="rect" coords="3,1,118,120" href="../empresas.htm" />
</map>
<map name="Map6" id="Map6"><area shape="rect" coords="4,4,117,120" href="../noticias.htm" />
</map>
</body>
</html>