Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [MySQL] dubluje połowe
Forum PHP.pl > Forum > Przedszkole
gOdi_1991
Witam, mam problem dubluje mi wynik zapytania z pętli w dziwny sposób proszę o pomoc ! Tutaj jest link ( efekt )

http://e-desing.xaa.pl/index.php?step=shop

fragment php
  1. <?php
  2. include_once('cfg.php');
  3. $result1 = mysql_query("SELECT id, image_small, image_big, info, coder, graphic, kesh FROM products ORDER BY id DESC")
  4. or die("Niepoprawne zapytanie MySQL");
  5. while ($shop = mysql_fetch_array($result1))
  6. {
  7. $tablica[] = $shop;
  8.  
  9. }
  10. $smarty->assign('result1',$tablica);
  11.  
  12. ?>
  13.  


oraz tpl
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Sklep</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6.  
  7. <link href="templates/style.css" rel="stylesheet" type="text/css" />
  8. </head>
  9. <body>
  10. <table>
  11. {foreach from=$result1 key=myId item=shop}
  12. <tr> <td>
  13. <img src="templates/images/uploads/{$shop.image_small}">
  14. </td> <td>
  15. <table>
  16. <tr><td>Cena:</td><td>{$shop.kesh},00 zł</td></tr>
  17. <tr><td>Koder:</td><td>{$shop.coder}</td></tr>
  18. <tr><td>Grafik:</td><td>{$shop.graphic}</td></tr>
  19. <tr><td>Opis:</td><td>{$shop.info}</td></tr>
  20. </table>
  21. </td>
  22. </tr>
  23. {/foreach}
  24. </table>


Dodam że na tej samej zasadzie działają u mnie newsy i nie ma takiego problemu sad.gif
Neeke
Spróbuj zamiast foreach zastosować section w smarty.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.