Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/03/2012, 15:16
Avatar de canserbero
canserbero
 
Fecha de Ingreso: marzo-2012
Ubicación: Lima, Peru, Peru
Mensajes: 1
Antigüedad: 12 años, 2 meses
Puntos: 1
filas e imagenes

ola ,espero q este tema lo este poniendo en el lugar correcto!!
weno estoy rompiéndome la cabeza con esto
...bueno loq kiero hacer es guardar en base datos la ruta de las fotos(cosa q ya esta),pero el problema esq quiero hacer q se muestre 4 fotos,luego la quinta foto se pase a la siguiente fila.


bueno este es el codigo
Código PHP:
Ver original
  1. <style type="text/css">
  2. <!--
  3. a:link {
  4.     text-decoration: none;
  5. }
  6. a:visited {
  7.     text-decoration: none;
  8. }
  9. a:hover {
  10.     text-decoration: none;
  11. }
  12. a:active {
  13.     text-decoration: none;
  14. }
  15. -->
  16. </style>
  17.  
  18. <table width="1041" height="582" border="1" >
  19.   <tr>
  20.     <td width="64" height="287">&nbsp;</td>
  21.     <td width="476">
  22.       <p>
  23.         <?
  24.    
  25.     //mostra imagen principal
  26.     if(!isset($_GET['id'])){
  27.     $conexion1 = mysql_connect('localhost','root','telesup');
  28. mysql_select_db("mibase",$conexion1);
  29.     $re1=mysql_query("SELECT * FROM imagen ORDER BY id DESC LIMIT 1 ");
  30. $reg1 = mysql_fetch_array($re1, MYSQL_BOTH);
  31. while($reg1)
  32. {
  33.    echo '<img src="'.$reg1[2].'" width="450" heigth="450"/>';
  34.    break; }
  35.    }
  36. else{
  37.    $conexion1 = mysql_connect('localhost','root','telesup');
  38. mysql_select_db("mibase",$conexion1);
  39.     $re1=mysql_query("SELECT * FROM imagen where id=".$_GET['id']."");
  40. $reg1 = mysql_fetch_array($re1, MYSQL_BOTH);
  41. while($reg1)
  42. {
  43.    echo '<img src="'.$reg1[2].'" width="450" heigth="450"/>'."\n";
  44.    echo "<p>"."Nombre:  "."".$reg1[1].""."</p>";
  45.    echo "<p>"."Descripcion:</p>";
  46.    echo "<p>"."".$reg1[3].""."</p>";
  47.    break; }
  48.    
  49.    }
  50.     ?>    
  51.    </td>
  52.     <td width="479">&nbsp;</td>
  53.   </tr>
  54.   <tr>
  55.     <td height="142" colspan="2"><?php
  56. $conexion = mysql_connect('localhost','root','telesup'); //REALIZA LA CONEXION
  57. mysql_select_db("mibase",$conexion);//SELECCIONA LA BASE DE DATOS "USUARIOS"
  58.  
  59.  
  60. echo "<table border = '1'> \n";
  61.  
  62. echo "<tr> \n";
  63.  
  64. echo "</tr> \n";
  65.  
  66.  $re=mysql_query("select * from imagen ORDER BY ID  LIMIT 4");
  67. $reg = mysql_fetch_array($re, MYSQL_BOTH);
  68. $rows_per_page=3;
  69. while($reg)
  70. {
  71.  
  72. echo "<td><a href=\"ejem.php?id=$reg[0]\">".'<img src="'.$reg[2].'" width="150" heigth="150"/>'."</td> ";
  73.  
  74. $reg = mysql_fetch_array($re, MYSQL_BOTH);
  75.  
  76. }echo "</table>";
  77. mysql_close($conexion);
  78. ?></td>
  79.     <td>&nbsp;</td>
  80.   </tr>
  81.   <tr>
  82.     <td height="143" colspan="3">&nbsp;</td>
  83.   </tr>
  84. </table>

mi base datos solo conta con los siguientes campos
id(int(3)) nombre(varchar(100) foto(blob) descripcion(varchar(200))

espero q me ayuden...si no me supe esplicar bien diganmelo