The script below displays "North America," where $Name is an array that includes the value "North_America."
Can I replace 'North_America' with an array that includes all the continents? If so, how? I tried the script below, but it isn't working. Thanks.PHP Code:$val = array_search('North_America', $Name);
if ($val>-1)
echo 'North America';
else
echo "Value isn't present.";
PHP Code:$Continents = array("North_America", "South_America", "Africa");
$query = "SELECT * FROM gzdistpractice";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
$Name[] = $row['Name'];
echo($row['Name']);
print_r($Name);
}
$val = array_search($Continents, $Name);
if ($val>-1)
echo 'Continent';
else
echo "Value isn't present.";




First comes the needle (the thing you're looking for), then the haystack (the array). I always have to check it from php.net, just in case 
Bookmarks