I am having a problem with access to a MYSQL database using PHP4. My form actually has four dropdown boxes -- I can access all the fields in my table with the dropdowns except the field named "whis". I have tried it with a different field in the same location in my code and it works perfectly. I have tried not using $whis and using one of the actual names - East Matagorda Bay - and that works. But when I use $whis my result page is blank. The field "whis" in my "fishing" table is varchar and is 50 characters long.
SEARCH.HTML has the following piece of code:
<FORM action=http://www.test.com/results.php method=post>
The form has the following dropdown box in it - it also has three other dropdown boxes:
<td width="37%">
<center>
<select name=whis>
<option value=Carancahua Bay>Carancahua Bay
<option value=East Matagorda Bay selected>East Matagorda Bay
<option value=Gulf of Mexico>Gulf of Mexico
<option value=Keller Bay>Keller Bay
<option value=Lavaca Bay>Lavaca Bay
<option value=Pass Cavallo>Pass Cavallo
<option value=Tres Palacios Bay>Tres Palacios Bay
<option value=West Matagorda Bay>West Matagorda Bay
<option value=Miscellaneous>Miscellaneous
</option>
</select>
RESULTS.PHP - if I take out the "and whis='$whis' the page brings back results from the database -- which that left in, I get a blank page. It has the following code in it:
$result = mysql_select_db("fishing",$db);
$result = mysql_query( "select * from fishing where fish='$fish' and wind='$wind' and month='$month' and whis='$whis'");
while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "<strong>Location: </strong>";
echo htmlspecialchars (stripslashes ($line["location"]));
echo "<br>";
echo "<strong>Rating: </strong>";
echo htmlspecialchars (stripslashes ($line["rated"]));
echo "<br>";
echo "<strong>Where: </strong>";
echo htmlspecialchars (stripslashes ($line["whis"]));
echo "<br>";
echo "<hr width=50% color=#003366>";
echo "<br>";
}
print "</table>\n";
#printf("Closing db\n");
mysql_close($db);
?>
This is driving me nuts - I'm a beginner but everything looks correct and the code works when I substitute another field. It's like PHP doesn't like the $whis variable or something. Can anyone tell me what I'm doing wrong?
Thanks,
Lucy Schelle
lschelle@wcnet.netl