Ver Mensaje Individual
  #8 (permalink)  
Antiguo 07/10/2011, 09:48
Avatar de JuJoGuAl
JuJoGuAl
 
Fecha de Ingreso: julio-2009
Ubicación: Venezuela
Mensajes: 754
Antigüedad: 14 años, 9 meses
Puntos: 19
Respuesta: Tablas con OrderBy

Cita:
Iniciado por jazhiel Ver Mensaje
Jaronu no he conseguido hacer nada con el code que me pasaste en cuanto quiero editarlo me tira errores ademas usas variables que no estan declaradas en ese fichero..

Alguien me podria ayudar a crear el code partiendo del que ya he posteado, es decir con los parametros y cojer datos igual como lo que habia hecho antes..

solo que en el code que he hecho me permite solo una fila :/
Creo que lo que necesitas hacer es esto:

Código PHP:
Ver original
  1. <?php
  2. mysql_select_db($database_Bdatos, $Bdatos);
  3. $queryprod = "SELECT * FROM productos ORDER BY RAND() DESC LIMIT 0,9";
  4. $productos = mysql_query($queryprod, $Bdatos) or die(mysql_error());
  5. $productosrow = mysql_fetch_assoc($productos);
  6. $productostotal = mysql_num_rows($productos);
  7. ?>
  8.  
  9. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  10.   <tr>
  11.     <td class="TitArt">Nuestros Productos: </td>
  12.   </tr>
  13. </table>
  14.  
  15.                     <!--Productos Destacados-->
  16. <table border="0" align="center" cellspacing="5">
  17.     <?php
  18.     $endRow = 0;
  19.     $columns = 3; // Numero de Columnas
  20.     $hloopRow1 = 0; // Flag
  21.     do
  22.         {
  23.             if($endRow == 0  && $hloopRow1++ != 0)
  24.             echo "<tr>";
  25.             echo "<td>";
  26.             ?>
  27.             <!--Lo que va a aqui es lo que se va a repetir por cada Resultado-->
  28.             <table width="100%" border="0" cellspacing="0" cellpadding="0">
  29.                 <tbody>
  30.                     <tr>
  31.                         <td colspan="4" width="204" height="36"><img src="imagenes/Arriba.png"/></td>
  32.                     </tr>
  33.                     <tr>
  34.                         <td width="37" height="118"><img src="imagenes/Izquierda.png"/></td>
  35.                         <td width="130" height="118" bgcolor="#FFFFFF" align="center">
  36.                         <?php
  37.                         $imgs= $productosrow['img'];
  38.                         $urlbase="C:/AppServ/www/1/imagenes/productos/";
  39.                         $ruta="$imgs.jpg";
  40.                         $imagen=$urlbase;
  41.                         $imagen.=$ruta;                    
  42.                         $datos=getimagesize ($imagen);
  43.                         $anchodes=122;
  44.                         $altodes=110;
  45.                         $ancho_orig=$datos[0];
  46.                         $alto_orig=$datos[1];
  47.                        
  48.                         # Se calculan las nuevas dimensiones de la imagen
  49.                         if ($ancho_orig>$alto_orig)
  50.                             {
  51.                             $ancho_dest=$anchodes;
  52.                             $alto_dest=($ancho_dest/$ancho_orig)*$alto_orig;
  53.                             }
  54.                         else
  55.                             {
  56.                             $alto_dest=$altodes;
  57.                             $ancho_dest=($alto_dest/$alto_orig)*$ancho_orig;
  58.                             }
  59.                         ?>
  60.                         <img src="/1/imagenes/productos/<?php echo $imgs; ?>.jpg" width="<?php echo $ancho_dest; ?>" height="<?php echo $alto_dest; ?>">
  61.                         </td>
  62.                         <td width="37" height="118"><img src="imagenes/Derecha.png"/></td>
  63.                         <td>&nbsp;</td>
  64.                     </tr>
  65.                     <tr>
  66.                         <td colspan="4" width="204" height="36"><img src="imagenes/Abajo.png"/></td>
  67.                     </tr>
  68.                 </tbody>
  69.             </table>
  70.             <table width="100%" border="0" cellspacing="0" cellpadding="0">
  71.                 <tbody>
  72.                     <tr>
  73.                         <td width="11" height="11"><img src="imagenes/ListEsq1.png"></td>
  74.                         <td height="11" background="imagenes/ListBg1.png"></td>
  75.                         <td height="11" width="50" background="imagenes/ListBg1.png"></td>
  76.                         <td width="28" height="11"><img src="imagenes/ListEsq2.png"></td>
  77.                     </tr>
  78.                     <tr>
  79.                         <td width="11" background="imagenes/ListBg2.png"></td>
  80.                         <td colspan="2" bgcolor="#C7C4C4">
  81.                         <table width="180" height="30" border="0" cellspacing="0" cellpadding="0">
  82.                         <!--Esta Tabla tiene los Preliminares del Producto-->
  83.                             <tr>
  84.                                 <td class="TitArt" valign="top"><?php echo $productosrow['producto']; ?></td>
  85.                             </tr>
  86.                            
  87.                         </table>
  88.                         </td>
  89.                         <td width="28" background="imagenes/ListBg4.png"></td>
  90.                     </tr>
  91.                     <tr>
  92.                         <td width="11" height="58"><img src="imagenes/ListEsq3.png"></td>
  93.                         <td height="58" width="130" background="imagenes/ListBg3.png">
  94.                            
  95.                         </td>
  96.                         <?php
  97.                         $producto=$productosrow['ID'];
  98.                         $producto=base64_encode($producto);
  99.                         $url="?page=DetallesProductos&productoid=$producto";
  100.                         ?>
  101.                         <td colspan="2" width="78" height="58">
  102.                         <a id="Detalles" href="<?php echo $url; ?>" title="Detalles"><span>Detalles</span></a>                     
  103.                         </td>
  104.                     </tr>
  105.                 </tbody>
  106.             </table>
  107.  
  108.             <?php
  109.             echo "</td>";
  110.             $endRow++;
  111.             if($endRow >= $columns)
  112.                 {
  113.                     echo "</tr>";
  114.                     $endRow = 0;
  115.                 }
  116.         }
  117.         while ($productosrow = mysql_fetch_assoc($productos));
  118.         ?>
  119. </table>
  120. <?php
  121. mysql_free_result($productos);
  122. ?>

muestro una cantidad de imagenes (segun el limit) en una tabla y muestro 3 por fila... Edita el codigo para que trabaje con lo que buscas...

Es un proyecto que hice hace unos meses y meti tabla sobre tabla pero creo que hace lo que quieres..

Avisame si te sirvio