Forum Moderators: coopster
This function sits at the end of the page, right after the connection function:
function getStopGIS()
{
$query = "SELECT * FROM GIS WHERE State='$State' AND Stop='$Stop'";
$result = mysql_query($query)
or die ("Couldn't execute query.");
return mysql_fetch_array($result,MYSQL_ASSOC);
}
And the script is above, just after the connection function call:
getStopGIS();
$getStopGIS = getStopGIS();
$County = $getStopGIS['County'];
$Elevation = $getStopGIS['Elevation'];
$Long_degree = $getStopGIS['Long_degree'];
$Long_minutes = $getStopGIS['Long_minutes'];
$Lat_degree = $getStopGIS['Lat_degree'];
$Lat_minutes = $getStopGIS['Lat_minutes'];
echo "<h2>Welcome to $Stop, $State of $County County!</h2>\n
<table border=\"0\">\n
<tr><td>Elevation:</td><td>$Elevation feet</td></tr>\n
<tr><td>Longitude:</td><td>$Long_degree degrees, $Long_minutes minutes</td></tr>\n
<tr><td>Latitude:</td><td>$Lat_degree degrees, $Lat_minutes minutes</td></tr>\n
</table>\n
</body>\n
</html>\n";
You should use global [us2.php.net] so you can use those vars inside the function.
function getStopGIS()
{
global $State, $Stop;...
}
[edited by: Psychopsia at 10:45 pm (utc) on Sep. 20, 2006]