Re: Problem with array
| From: | Stuart McDonald | Date: | Wed, 23 Aug 2000 23:58:52 +0000 |
| Subject: | Re: Problem with array | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2310@lists.php.net to get a copy of this message | ||
Daniel,
This is how I did what you are trying to do:
____start____
<form action="province.php3" method="get">
<select name="provid">
<?php
$result99 = mysql_query("SELECT * FROM province ORDER BY name",$db);
if ($myrow = mysql_fetch_array($result99)) {
do {
$name=$myrow["name"];
printf("\t<option
value=%s>%s\n",$myrow["provid"],$myrow["name"]);
} while ($myrow = mysql_fetch_array($result99));
} else{
echo "no records";
}
?>
</select>
<br>
<input type="image" border="0" src="graphics/buttons/go.gif"
alt="Go!"
value="Go!">
</form>
____ends____
It seems to work fine
HTH
Stuart
----- Original Message -----
From: Daniel Rezny <dr@photo.digitallaut.at>
To: php-db <php-db@lists.php.net>
Sent: Wednesday, August 23, 2000 9: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
>
>