Hi, I am trying to add a form that would allow users to select which
county's data to map. I would like to use
$county = $_REQUEST["county"];
in the following code. Two questions: Is this where I should put this
piece? Do you see anything else that is wrong with this? I know all
of the variable names are correct, and the data shows up fine on the
map when there is no form. There is also no errors showing with the
html, prompting me to think that the problem is here.
<?php
//Establishes the connection to the database
$link=mysqli_connect("...");
//sets up the SQL statement
$sql_er="
SELECT weather.id,
weather.name,
weather.stncode,
weather.county,
weather.elevation,
weather.lat,
weather.long
FROM weather
WHERE weather.county='$county';
";
//Calls the results of the first SQL statement
$result = mysqli_query($link,$sql_er);
//Checks to see if it is a legit SQL statement through an IF statement
if ($result!=0){
//Conversts php to XML so it can be read in the HTML file
header("Content-type:text/xml");
print'<weather>'; //This is the XML array it will be printed in
//Creates an array of rows from the SQL Statement through a FOR loop
$num_results = mysqli_num_rows($result);
for ($i=0;$i<$num_results;$i++){
$row = mysqli_fetch_array($result);
$id = $row['id'];
$name = $row['name'];
$stncode = $row['stncode'];
$county = $REQUEST_['county'];
$elevation = $row['elevation'];
$lat = $row['lat'];
$long = $row['long'];
//print the called fields into the array...
print '<er id="'.$id.'" name="'.$name.'" stncode="'.$stncode.'"
county="'.$county.'" elevation="'.$elevation.'" lat="'.$lat.'" long="'.
$long.'">';
print '</er>';
}
//close the array tag
print'</weather>';
//closes the link to the database
mysqli_close($link);
}
?>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.