I have a function that's supposed to query mysql with a zip code, and generate an html <select> box with possible cities. Instead, it crashes the site and gives this error:
Fatal error: Can't use function return value in write context in /home/rahl/public_html/RVM/include/functions.php on line 298
The content of the function is:
function zip_code_city_handler($zip)
{
global $zip;
$query = "SELECT * FROM zip WHERE zip = '$zip'";
$result = safe_query($query);
if (mysql_num_rows($result) = 1)
{
$city_select = "<select>";
while($row = mysql_fetch_array($result))
{
$city_select .= "<option>".$row['city']."</option>";
}
$city_select .= "</select>";
}
else
{
$row = mysql_fetch_array( $result );
$city_select = $row['city'];
}
return $city_select;
}
I've never gotten this error before and I'm not really sure what it means...
Any help is appreciated, as always.
Thanks,
Nick