I am transitioning from 'old school' PHP MySQL methods of using mysql_fetch_array()
, etc. and I am trying to be more Drupally by using the Database API in my modules.
I simply want to return and print out a value. For example:
$query = db_query("SELECT zip FROM {zipcodes} WHERE city = :city LIMIT 1", array(":city" => $city));
I know the value is there, I can access and print it by using traditional methods outside the database API.
print $query->zip
is not working.
The API documentation is as clear as mud.
Can someone tell me the correct way to access these values?
Is there a good tutorial anyone could recommend as well?