Newbie...probably a simple question...variables
$conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS)
or die('Could not connect to MySQL database. ' . mysql_error());
mysql_select_db(SQL_DB,$conn);
$query = "SELECT airport_id FROM tblairports WHERE airportstate = 'az' ORDER BY airportstate, airport_id";
$results = mysql_query($query) or die(mysql_error());
while ($rows=mysql_fetch_array($results)) {
extract($rows);
echo $airport_id . " ";}
I'm using the above to access a database. My connection works great, as the last echo returns the value's I want.
What I would like to do is be able to include those values in a variable. I was hoping something like $arizona = echo $airport_id . " "; would work, but it doesnt appear to. Anyone have any idea as to how I go about turning that last echo statement into a variable.
The variable will then be passed on to a NWS site and retrieve weather for all the airports. I have done this successfully, I just cant seem to get the variable to work right.
Thanks!
|