Re: one row?
| From: | (Philip Hallstrom) | Date: | Thu, 20 Jul 2000 19:27:25 +0000 |
| Subject: | Re: one row? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7468@lists.php.net to get a copy of this message | ||
In article <000d01bff27a$bb34e100$2755d0d1@jeff>,
Data Driven Design <jeff@datadrivendesign.com> wrote:
>This is some code I've been testing and for some reason the middle section
>only puts one row into the select box. What am I missing?
>if (isset($searchState)) {
>
> if (isset($searchCity)) {
> $query .= " WHERE City = '$searchCity' AND State =
> '$searchState'";
> $display=true;
> } else {
> $state_query = "SELECT DISTINCT City FROM florists WHERE State =
>'$searchState' ORDER BY City";
> $state_result = @mysql_query($state_query);
> if (mysql_num_rows($state_result)) {
> print "<form action=\"$PHP_SELF\" method=\"post\">\n";
> print "<input type=\"hidden\" name=\"searchState\"
>value=\"$searchState\">\n";
> print "<select name=\"searchCity\">\n";
> while ($row = mysql_fetch_row($state_result)) {
> print "<option>$row[0]</option\n";
You're missing a closing ">" for the closing OPTION tag.
Also, I'm assuming that when you run the query in mysql directly it
returns more than one row there as well?
P.S. - I mean this in the best way, but I would start indenting your
code a bit more and spacing it out so it's easier to read... it will
help find errors more quickly since you don't get lost :)
-philip