title: PHP global $db call in function
body: <p>I have the following code:</p>
  
  <pre><code>function beginProcess(){
      global $db; 
      $sql = "SELECT last_batch from ".TABLE_STATUS.";";            
      $lastBatch = $db-&gt;Execute($sql);
      $lastBatch=(int)$lastBatch-&gt;fields['last_batch'];
      echo "&lt;BR/&gt;Last Batch = ".$lastBatch;
  
      if ($lastBatch &gt;=1 &amp;&amp; $lastBatch &lt;=3 ){
          $batch = $lastBatch +1;
      }else{
          $batch = 1;
      }
          processBatch($batch);
  }
  </code></pre>
  
  <p>Will $db be available to the processBatch function so I can use db functionality or do I have to define it again in processBatch() ?</p>