title: check db_query returns empty
body: <p>How to check the query result returns empty or not.  I found no other way and tried this but still getting issue.</p>
  
  <pre><code>$ww = db_query("SELECT item1,id FROM db_item WHERE db_item.id = '".$record-&gt;data1."'" );
  $d=0;
  foreach($ww as $ee){
          $d=11;
          $ed =  $ee-&gt;item1;
          $options2.="$ed";
  }
  if($d!=11){
          $options2.="No ITEM added!";
  }
  </code></pre>
  
  <p>EDIT</p>
  
  <pre><code> $ww = db_query("SELECT item1,id FROM db_item WHERE db_item.id = '".$record-&gt;data1."'" );
    if(!empty($ww)){ 
    foreach($ww as $ee){
          $d=11;
          $ed =  $ee-&gt;item1;
          $options2.="$ed";
      }
   }
        else{
          $options2.="No ITEM added!";
  }
  </code></pre>