|
Posted by Jerry Stuckle on 12/29/05 17:37
Leszek wrote:
> Hi.
> How can I get just one row from selected column and put it into html
> dropdown list
> I tried like this:
>
> function pobierz_wszystko($tabela,$kolumna)
> {
> $zapytanie="SELECT $kolumna FROM $tabela";
> $wynik=mysql_query($zapytanie);
> while($wiersz=mysql_fetch_array($wynik,MYSQL_ASSOC))
> {
> echo "<option value=$wiersz>$wiersz</option> <br />";
> }
> }
>
> <select name="$hname">
> <option value="*" selected >All</option>
> <?php
> pobierz_wszystko('hotel','hotel_nazwa');
> ?>
> </select>
>
>
> But it doesn't work properly because I'm getting a dropdown list with
> All,and Array,Array,Array,Array,Array
> Instead of Array I'd like to have a value from a row.
>
> Is it because I'm using mysql_fetch_array($wynik,MYSQL_ASSOC)?
> or maybe the query is wrong?
>
> Thanks
> Leszek
>
>
http://www.php.net/manual/en/function.mysql-fetch-array.php
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|