Hi all
I'm trying to create a function that will return an array of values. And more importantly i want to be able to access parts of the array specifically
here's my code so far
function find_hotels_in_location($location_id)
{
global $location_id;
$SQL = "SELECT * FROM hotels WHERE city='$location_id'";
$result = mysql_query($SQL);
$num_rows = mysql_num_rows($result);
$counter = 0;
while($counter < $num_rows)
{
$row = mysql_fetch_array($result);
$hotel_details[$counter][id] = $row["id"];
$hotel_details[$counter][name] = $row["name"];
$hotel_details[$counter][chain_code] = $row["chain_code"];
$hotel_details[$counter][property_id_code] = $row["property_id_code"];
$counter++;
}
return $hotel_details;
}
What have i done wrong?
How would i be able to grab just the chain_code(for example)
thanks