title: PHP Class not Returning Result
body: <p>I am working on an Item Inventory Web App. I want users should be able to add and assign item to a user. Each user is entitled to one item at a time. If, say, user a already has an item assigned and you want to add more item, the system should lodge an error that will tell you 
  to withdraw the item be issuing a new one but the errors are not getting lodged in the <code>error[]</code> array even though it shows that the array is not empty. It only echo out the serial number <code>a = 1 and a++</code> but the text is not there.</p>
  
  <p><strong>class.inc.php</strong></p>
  
  <pre><code>class Summary {
      public $result;
      public $conn;
      public $SQ;
      public $q;
      public $updateDB;
      public $checkDB;
      public $returned_result;
      public $a;
      public $data;
      public $col;
  
      public function __construct(){
          $this-&gt;conn = new PDO('mysql:host=localhost; dbname=dB', 'root', '');
          $this-&gt;conn-&gt;setAttribute(PDO:: ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      }
      public function updateDB($coloumn, $data, $id){
          $SQ = "UPDATE mytable SET $coloumn = ? WHERE staffID = ?";
          $q = $this-&gt;conn-&gt;prepare($SQ) or die("ERROR: " . implode(":", $this-&gt;conn-&gt;errorInfo()));
          $q-&gt;bindParam(1, $data);
          $q-&gt;bindParam(2, $id);
          if ($q-&gt;execute()){
              $success = 'Record updated successfully';
          };
          return $success;
      }
  
      public function checkDB($col, $data){
          $status = 'Active';
          $SQ = "SELECT surname FROM mytable WHERE $col = ? AND status = ?";
          $q = $this-&gt;conn-&gt;prepare($SQ) or die("ERROR: " . implode(":", $this-&gt;conn-&gt;errorInfo()));
          $q-&gt;bindParam(1, $data);
          $q-&gt;bindParam(2, $status);
          $q-&gt;execute();
          if($result = $q-&gt;fetch(PDO::FETCH_BOTH)){
              $a = $result[0];
              if ($a == ''){
                  $this-&gt;returned_result = 'N';
              }
              else {
                  $this-&gt;returned_result = "This item (". $data . ") is in use by ". $a . ". Please widthraw the item";
              }
          }
          return $this-&gt;returned_result;
      }
  }
  </code></pre>
  
  <p><strong>index.php:</strong></p>
  
  <pre><code>include('class.inc.php');
  $summary = new Summary;
  $error = array();
  if(isset($_POST['saveRecord']) ) {
  $system_name = strtoupper ( $_POST['system_name'] );
  $result =$summary-&gt;checkDB('systemName', $system_name); //check if the item is in use
  if ( $result == 'N' ){
      $summary-&gt;updateDB('systemName', $system_name, $id);
      $update = $summary-&gt;updateDB;
  }
  else $error[] = $result;
  
  
  $system_serial_number = strtoupper ( $_POST['system_serial_number'] );
  
  $result =$summary-&gt;checkDB('CPUSerial', $system_serial_number); //check if the item is in use
  if ( $result == 'N' ){
      $summary-&gt;updateDB('CPUSerial', $system_serial_number, $id);
      $update = $summary-&gt;updateDB;
  }
  else $error[] = $result;
  }
  
  if(isset($_POST['saveRecord']) &amp;&amp; !empty( $error ) ) {
  echo "&lt;div class = 'text-error'&gt;";
  $a = 1;
  foreach ($error as $err){
      echo '&lt;p&gt;' . $a . '. ' .$err . '&lt;/p&gt;';
      $a++;
  }
  echo "&lt;/div&gt;";
  }
  </code></pre>
  
  <p>Any help will be greatly appreciated. And what am I doing wrong with regards to <code>OOP</code> way of programming?</p>