Ver Mensaje Individual
  #2 (permalink)  
Antiguo 06/11/2011, 10:11
Avatar de charlyalegret
charlyalegret
 
Fecha de Ingreso: septiembre-2011
Ubicación: Barcelona
Mensajes: 705
Antigüedad: 12 años, 7 meses
Puntos: 140
Respuesta: Recolocar campos MySQL-PHP

Algo así a lo mejor te serviría, aunque seguro que hay alternativas mejores... te he puesto más separado lo que he añadido. Esto lo he hecho así sin mirarlo mucho osea que puede contener errores, es sólo una posible base sobre la que podrías trabajar ajustándolo a tus necesidades. Suerte!



Código PHP:
Ver original
  1. <?php
  2. $connexio = mysql_connect('localhost', 'usu_jocs', 'MyGameStore2012');
  3. mysql_select_db('mygamestore', $connexio);
  4.  
  5. $taula = mysql_query("SELECT Imatge, Nom_Joc, Preu, PEGI, Genere, Data_Publicacio FROM jocs LIMIT 6");
  6.  
  7.           $i=0;
  8.            echo "<table><tr>";
  9.  
  10. while ($registre = mysql_fetch_array($taula)){
  11.  
  12.           echo "<td>";
  13.           $i++
  14.  
  15. $extensio = $registre['Imatge'] . ".jpg";
  16. $img = "<img width=110 height=147 src=$extensio></img>";
  17.  
  18. echo "<table border=0 width=360px>";
  19. echo "<tr>";
  20. echo "<td rowspan=2 width=120px>";
  21. echo $img;
  22. echo "</td>";
  23. echo "<td valign=top>";
  24. echo "<b>" . "<font color=#D33400>" . $registre['Nom_Joc'] . "</font>" . "</b>";
  25. echo "<hr color=#D33400>";
  26. echo $dataord;
  27. echo "<br>";
  28. echo $registre['Genere'];
  29. echo "<br><br>";
  30. echo "PEGI: +" . $registre['PEGI'];
  31. echo "<br>";
  32. echo "Preu: " . $registre['Preu'] . " €";
  33. echo "</td>";
  34. echo "</tr>";
  35. echo "</table>";
  36. echo "<br><br>";
  37.  
  38.           echo "</td>";
  39.           if ($i == 3) {
  40.           echo "</tr><tr>";
  41.           $i=0;}
  42.  
  43. }
  44.  
  45.           echo "</tr></table>";
  46.  
  47. mysql_close($connexio);
  48. ?>