title: Call to undefined function even though the function is on an include
body: <p>I am working on a PHP file that will export data from a table to an Excel file. One piece of code I need to use is in a file that I <code>include</code>d in the current file. When I try to run the code, however, I get the following error: <code>Fatal error: Call to undefined function buscarFaltantesPorProveedor() in /require/exportarFaltantesExcel.php on line 13</code>.</p>
  
  <p>I am guessing I get this error because I am calling a class variable, but I am not sure. Can you please help me? Thanks!</p>
  
  <p>PHP excel code:</p>
  
  <pre><code>&lt;?php
  error_reporting(E_ALL | E_WARNING | E_NOTICE);
  ini_set('display_errors', 1);
  
  include('../accesodatos/consultas.php');
  require_once('../excel/Classes/PHPExcel.php');
  require_once('../excel/Classes/PHPExcel/IOFactory.php');    
  $proveedor = $_GET['proveedor'];
  echo $proveedor;
  
  $objPHPExcel = new PHPExcel();
   // $objPHPExcel = new PHPExcel();
  $query = buscarFaltantesPorProveedor($proveedor);
   $row = 1;
  
   while($row_data = mysql_fetch_array($query)){
      $col = 0;
      foreach($row_data as $key=&gt;$value) {
          $objPHPExcel-&gt;getActiveSheet()-&gt;setCellValueByColumnAndRow($col, $row, $value);
          $col++;
      }
      $row++;
  }
  
   header('Content-Type: application/vnd.openxmlformats-   officedocument.spreadsheetml.sheet');
   header('Content-Disposition: attachment;filename="'.$proveedor.date("Y-m-d").'".xlsx"');
   header('Cache-Control: max-age=0');
  
   $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
   $objWriter-&gt;save('php://output');
  ?&gt;
  </code></pre>
  
  <p>Piece of code in consultas.php:</p>
  
  <pre><code>function buscarFaltantesPorProveedor($proveedor){
  conectar();
  if(strcmp($proveedor,"Todos") == 0){
      $instruccion = "SELECT * FROM articulos, estatus, ordenes, proveedor WHERE art_id_estatus = est_id AND art_id_orden = ord_id AND art_id_proveedor = pro_id_clave AND art_num_guia IS NULL";
  }else{
      $instruccion = "SELECT * FROM articulos, estatus, ordenes, proveedor WHERE art_id_estatus = est_id AND art_id_orden = ord_id AND art_id_proveedor = pro_id_clave AND art_num_guia IS NULL and pro_id_clave = '$proveedor'";
  }
  
  $tabla = mysql_query($instruccion);
  return $tabla;
  }
  </code></pre>
  
  <p>Also, I tried using <code>$this</code> to call the method but I also got an error. Why is that? Can't I use <code>$this</code> on a method?</p>