Re: Dropdown list question...
| From: | Bob Lockie | Date: | Mon, 29 Jul 2002 16:24:49 +0000 |
| Subject: | Re: Dropdown list question... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-20858@lists.php.net to get a copy of this message | ||
> I am populating a dropdown list from a database. This is working
>fine with one minor glitch... For some reason, the first entry in the
>database does not seem to be getting populated into the list. I do not see
>anything wrong, and was hoping that someone else might be able to spot a
>problem. Here is the code that generates the dropdown list:
>
>$query_systems = "SELECT Name FROM systems";
>$systems = mysql_query($query_systems, $Test) or die(mysql_error());
>$row_systems = mysql_fetch_assoc($systems);
>$totalRows_systems = mysql_num_rows($systems);
>$sys_list = "<select size=\"1\" name=\"system\">\n";
>$sys_list .= "<option>System Name</option>\n";
>$sys_list .= "<option>-----------</option>\n";
>while($name = mysql_fetch_row($systems)) {
> $sys_list .= "<option>$name[0]</option>\n";
>}
>$sys_list .= "</select>\n";
mysql_fetch_assoc (http://www.php.net/manual/en/function.mysql-fetch-assoc.php) and mysql_fetch_row
(http://www.php.net/manual/en/function.mysql-fetch-row.php)
both return a row.