title: mysql select query result is null so how can i return default value in php
body: <p>Facing the following error</p>
  
  <blockquote>
    <p>Error: Notice: Undefined index: id in /Applications/XAMPP/xamppfiles/htdocs/mks/opencart-1.5.6.1/upload/admin/controller/catalog/vendhqbridge.php on line 120</p>
  </blockquote>
  
  <p>Relevant code:</p>
  
  <pre><code>//check for existing 'VendHQ_id' on  DB's product table
  
  function checkVendHQid($flagChk)
  {
  $rs = $this-&gt;db-&gt;query("SELECT vendhq_id as id FROM ".DB_PREFIX."vendhq_product WHERE vendhq_id = '".$flagChk."'");
  
       $rowRsl=-1;
       if($rs===null)
      {
          $rowRsl = -1;
      }
      else
      {
         if($rs-&gt;row["id"] == $flagChk  )
         {
             $rowRsl = 1;
         }
      }
  
      return $rowRsl;
   }
  </code></pre>