Re: Problem with array
| From: | andreas \(@work\) | Date: | Wed, 23 Aug 2000 15:53:51 +0000 |
| Subject: | Re: Problem with array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13169@lists.php.net to get a copy of this message | ||
hi,
the prototyp of the function mysql_fetch_array is:
array mysql_fetch_array(int result, int [result_typ]);
where result_type is
MYSQL_ASSOC .......... for an assoziative array
MYSQL_NUM .............. for a numeric array
MYSQL-BOTH ............. for both
so in your case just use
$line = mysql_fetch_array($exec);
and all should work fine
andreas gstrein
viva technologies
tirol - austria
----- Original Message -----
From: "Daniel Rezny" <dr@photo.digitallaut.at>
To: "php-db" <php-db@lists.php.net>
Sent: Wednesday, August 23, 2000 4:41 PM
Subject: [PHP-DB] Problem with array
> Hello all,
>
> I have a very interesting problem with mysql and php.
> I want to make a html <select> tag with dynamicaly generated <option>.
> It works but not correct.
> This is the code
> $exec = mysql_query("select id,bezeichnung from kategorien where
user='".$userid."'");
>
> $count = mysql_num_rows($exec);
> echo $count;
>
> $katid=$row[0];
> $katname=$row[1];
>
>
> $i = 1;
>
>
> for($i=1; $i<=$count; $i++)
>
> {
> $line = mysql_fetch_array($exec, $i);
> echo ?><option value="<? echo
$line["id"];?>"><?echo
$line["bezeichnung"];?></option><?;
> }
>
>
> So and it is not writes every row from db but every second row. Do
> somebody know where is the problem.
>
> Thx for every help.
>
> --
> Best regards,
> Daniel mailto:dr@photo.digitallaut.at
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>