How do I get the result from a database and show it? I have a database table with the following fields: name, company_name, geo_loction. I want to get those fields using the following query. 

$zip_code = db_query("SELECT * FROM data_set WHERE id = 1", array(":city" =&gt; $city))-&gt;fetchObject();


Is that the correct code? How do I show the result?
//here $id value is hard-coded to 1, you can use your own logic to get the value.
$id = 1;
$result = db_query("select name, company_name, geo_location from {data_set} where id=:id", array(':id' =&gt; $id));

//To iterate over each row of the resultset use foreach
foreach($result as $ind_data) {
  echo "name is " . $ind_data-&gt;name . "&lt;br/&gt;";
  echo "company name is " . $ind_data-&gt;company_name . "&lt;br/&gt;";
  echo "geolocation is " . $ind_data-&gt;geo_location . "&lt;br/&gt;";
}