Pagina 1 di 1

Help per estrazione dati dal database

Inviato: 26/04/2004, 16:52
da giorgiogg
Dovrei estrarre dei dati da un os per inserirli in un motore di prodotti, in particolare i dati da estrarre sono i seguenti

Prodotto (nome prodotto)
Marca
Descrizione (max 200 caratteri)
Prezzo
Codice Prodotto
Link
Disponibilità (non ancora implementato, se non lo potete mettere fa niente)
Categoria (esempio Fotografia,Macchine Digitali) (le categorie andrebbero separate o da , o ; )
URL Immagine piccola
Costo Spedizione (non ancora implementato, se non lo potete mettere fa niente)

Per delimitare va bene il carattere | (pipe)

Lavorando su alcune pagine sono riuscito ad fare questa pagina :

Codice: Seleziona tutto

<?php
/*
  $Id: catalog_products_with_images.php,v 1.5 by Tom St.Croix management@betterthannature.com

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2002 osCommerce

  Released under the GNU General Public License
*/

  require('includes/application_top.php');
  ?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">

         
<?php
  if ($HTTP_GET_VARS['page'] > 1) $rows = $HTTP_GET_VARS['page'] * 20 - 20;
$products_query_raw = "select *, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name";
  $products_query = tep_db_query($products_query_raw);
  while($products = tep_db_fetch_array($products_query)) {
    $rows++;

    if (strlen($rows) < 2) {
      $rows = '0' . $rows;
    }

 ?>
             
              <tr class="tableRow">
                <td class="tableData" align="center"><?php echo $products['products_name']; ?>|<?php echo $products['manufacturers_name']; ?>|<?php echo $products['products_model']; ?>|<?php echo $products['products_price']; ?>|<?php echo $products['products_model']; ?>|http://www.miosito.com/product_info.php?products_id=<?php echo $products['products_id']; ?>|<?php echo $products['products_quantity']; ?>|<?php echo $products['categories_id']; ?>|http://www.miosito.com/images/<?php echo $products['products_image']; ?></td>


              </tr>
<?php
  }
?>
              <tr>
                <td colspan="5"><?php echo tep_draw_separator(); ?></td>
              </tr>
            </table></td>
          <tr>
            <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td class="smallText"> </td>
                <td align="right" class="smallText"> </td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->


</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Dove ho due problemi: non di riesce ad estrarre l'id del prodotto per formare il link e dove non riesco a far identificare la categoria di apparteneza con il relativo nome in quanto mi esce (ovviamente) il numero (es cat 39)


chi mi aiuta a completarlo? grazie mille