I'm trying to supply a list/drop down that pulls cities from a mySQL database. I'm getting an error:
my code:
The list will be used to return data based on which city is picked, but I have to get the first part working first.
Thank you!
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ... line 73
my code:
Code:
<?php
...
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$query = "SELECT venue.venueid, venue.city FROM venue";
$result = mysql_query($sql);
$options="";
while ($row = mysql_fetch_array($result)) {
$id = $row["venueid"];
$city = $row["city"];
$options.="<OPTION VALUE=\"$id\">".$city.'</OPTION>';
}
?>
<form name="pickcity" method="post" action="">
Find a meeting in my city:
<SELECT NAME=city>
<OPTION VALUE = 0>Choose
<?=$options?>
</select>
</form>
The list will be used to return data based on which city is picked, but I have to get the first part working first.
Thank you!