p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 (http://p2p.wrox.com/forumdisplay.php?f=123)
-   -   Newbie...probably a simple question...variables (http://p2p.wrox.com/showthread.php?t=21693)

IP076 November 24th, 2004 12:58 PM

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());

$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)) {
    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.


czambran November 30th, 2004 01:10 PM

echo='echo $airport_id . " ";'


Snib November 30th, 2004 03:24 PM

Why don't you just add a line that sets the variable to the value?

-Snib - http://www.snibworks.com
Where will you be in 100 years?

All times are GMT -4. The time now is 01:04 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.