Could anyone tell me why this won't work?
Code: Select all
//Find the actual name of a town based on its ID from the database
function findtown( $city_closest )
{
mysql_select_db($dbname);
$sql = "SELECT * FROM towns WHERE town = $city_closest";
$content = mysql_query($sql);
$Xcontent = mysql_fetch_array($content);
return $town_id = $Xcontent["id"];
return $town_name = $Xcontent["town"];
return $town_state = $Xcontent["state"];
return $town_popularity = $Xcontent["popularity"];
}Code: Select all
$town = findtown($city_closest);I have connected to the database already in the script before I call the function and I've included the function in my script (as it's in a seperate file).
Stumped
Rob
UPDATE!!
I've tried this also, but no luck
Code: Select all
function findtown( $city_closest )
{
mysql_select_db($dbname);
$sql = "SELECT * FROM towns WHERE town = $city_closest";
$content = mysql_query($sql);
$Xcontent = mysql_fetch_array($content);
return ($town_id = $Xcontent["id"]);
return ($town_name = $Xcontent["town"]);
return ($town_state = $Xcontent["state"]);
return ($town_popularity = $Xcontent["popularity"]);
}