Ver Mensaje Individual
  #11 (permalink)  
Antiguo 06/05/2011, 10:13
marina_mesas
 
Fecha de Ingreso: noviembre-2010
Mensajes: 48
Antigüedad: 13 años, 5 meses
Puntos: 5
Respuesta: Como muestro una imagen

eresvey aca te dejo el script que ejecuta al iniciar el index.php, que ademas de cargar otros componentes carga productlist.php que es el que te voy a postiar abajo!! este funciona perfecto y recupera las imagenes a la perfeccion con sus datos correspondientes! Si no te sirve, desime a que tabla te referis? a la de DB?

Código PHP:
Ver original
  1. <?php // comienso del listado de producto sin el buscador
  2. if (!defined('WEB_ROOT')) {
  3.     exit;
  4. }
  5.  
  6. $productsPerRow = 1;
  7. $productsPerPage = 10;
  8.  
  9. $children = array_merge(array($catId), getChildCategories(NULL, $catId));
  10. $children = ' (' . implode(', ', $children) . ')';
  11.  
  12. $sql = "SELECT pd_id, pd_description, pd_thumbnail, pd_qty, c.cat_name, pd_price * sc_shipping_cost AS pd_price
  13.         FROM tbl_shop_config, tbl_product pd, tbl_category c
  14.         WHERE pd.cat_id = c.cat_id AND pd.cat_id IN $children
  15.         ORDER BY pd_description ASC";
  16. $result     = dbQuery(getPagingQuery($sql, $productsPerPage));
  17. $pagingLink = getPagingLink($sql, $productsPerPage, "c=$catId");
  18. $numProduct = dbNumRows($result);
  19.  
  20.  
  21. $columnWidth = (int)(100 / $productsPerRow);
  22. ?>
  23. <table width="100%" border="0" cellspacing="0" cellpadding="20">
  24. <?php
  25. if ($numProduct > 0 ) {
  26.  
  27.     $i = 0;
  28.     while ($row = dbFetchAssoc($result)) {
  29.    
  30.         extract($row);
  31.         if ($pd_thumbnail) {
  32.             $pd_thumbnail = WEB_ROOT . 'images/product/' . $pd_thumbnail;
  33.         } else {
  34.             $pd_thumbnail = WEB_ROOT . 'images/no-image-small.png';
  35.         }
  36.    
  37.         if ($i % $productsPerRow == 0) {
  38.             echo '<tr>';
  39.         }
  40.  
  41.        
  42.         $pd_price = displayAmount($pd_price);
  43.        
  44.         echo "<td width=\"$columnWidth=\" align=\"left\"><a><img src=\"$pd_thumbnail\" border=\"0\"></a></td>
  45.               <td width=\"$columnWidth%\" align=\"reight\"><a>Descripcion :  $pd_description</a><td><a> Precio : $pd_price</a>";
  46.              
  47.         if ($pd_qty <= 0) {
  48.             echo "<br> Agotado";
  49.         }
  50.        
  51.         echo "</td>\r\n";
  52.    
  53.         if ($i % $productsPerRow == $productsPerRow - 1) {
  54.             echo '</tr>';
  55.         }
  56.        
  57.         $i += 1;
  58.     }
  59.    
  60.     if ($i % $productsPerRow > 0) {
  61.         echo '<td colspan="' . ($productsPerRow - ($i % $productsPerRow)) . '">&nbsp;</td>';
  62.     }
  63.    
  64. } else {
  65. ?>
  66.     <tr><td width="100%" align="center" valign="center">No hay productos en esta categoria</td></tr>
  67. <?php  
  68. }
  69.    
  70. ?>
  71. </table>
  72. <p align="center"><?php echo $pagingLink; ?></p>
  73. <p align="center">&nbsp;</p>

Gracias por tu tiempo eresvey!!