Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Smarty] html_options
Siner
post
Post #1





Grupa: Zarejestrowani
Postów: 159
Pomógł: 6
Dołączył: 2.01.2004

Ostrzeżenie: (0%)
-----


Witam,
mam mały problem z funkcja html_options. Robie tak, pobieram dane z bazy danych:
  1. <?php
  2. $sql = 'SELECT id, nazwa FROM kategorie';
  3. $zapytanie = mysql_query($sql) or die(mysql_error());
  4. $galeria = array();
  5. while ($row = mysql_fetch_assoc($zapytanie))
  6. {
  7. array_push($galeria, $row);
  8. }
  9. $smarty->assign('galeria', $galeria);
  10. $smarty->assign('idgalerii', $_GET['idgalerii']);
  11. ?>


Następnie w pliku .tpl
  1. <select name="galeria">
  2. {html_options values=$galeria.id output=$galeria.nazwa selected=$idegalerii}

A jako wynik dostaje tylko:
  1. <select name="galeria">
  2.  

Z góry dzięki za pomoc.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
php programmer
post
Post #2





Grupa: Zarejestrowani
Postów: 1 045
Pomógł: 5
Dołączył: 8.11.2004
Skąd: trójmiasto

Ostrzeżenie: (0%)
-----


Cytat
Array (
[0] => Array ( [id] => 1 [nazwa] => Galeria 1 )
[1] => Array ( [id] => 2 [nazwa] => Galeria 2 )
[2] => Array ( [id] => 3 [nazwa] => Galeria 3 )
[3] => Array ( [id] => 17 [nazwa] => Galeria 4 )
[4] => Array ( [id] => 21 [nazwa] => Galeria 5 )
)


próbowałeś odwołać się w smarty do id, które
jest jedynie wartością w tablicy a nie tablicą

Ten post edytował php programmer 14.08.2006, 23:03:02
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 18.10.2025 - 12:35