0

I finished transitioning to PDO and am modifying my system according to fatal errors that pop up. ERR: Call to a member function execute() on a non-object in /home/a1933806/public_html/globals/server-bin/php/core.php LINE: 43

This is my setup with affected line in bold:

class netCore {
      private $armor;
      private $boot;
      private $dbHost = "*****.*******.com";
      private $dbNAME = "********";
      private $dbPASS = "********";
      private $dbUSR = "********";
      private $err;
      private $state;
      public function __construct() {
       $bootloadr = "mysql:host=".$this->dbHost.";dbname=".$this->dbNAME.";charset=UTF8";
       $opt = array(PDO::ATTR_PERSISTENT => true, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
       try {
        $this->boot = new PDO($bootloadr, $this->dbUSR, $this->dbPASS, $opt);
       } catch(PDOException $e) {
        $this->err = "<b>Lebensborn&reg; netCore&trade; Error:</b> An exception has been raised during Network-to-Database procedures.<br /><b>Message:</b> ".$e->getMessage().".";
       }
      }
      public function bind($param, $value, $type = null) {
       if(is_null($type)) {
        switch(true) {
         case is_int($value):
          $type = PDO::PARAM_INT;
          break;
         case is_bool($value):
          $type = PDO::PARAM_BOOL;
          break;
         case is_null($value):
          $type = PDO::PARAM_NULL;
          break;
         default:
          $type = PDO::PARAM_STR;
        }
       }
       $this->state->bindValue($param, $value, $type);
      }
      public function exe() {
       return $this->state->execute();
      }
      public function count() {
       return $this->state->rowCount();
      }
      public function q($q) {
       try {
        $this->armor = $this->boot->prepare($q);
        $this->state = $armor;
       } catch(PDOException $e) {
        $this->err = "<b>Lebensborn&reg; netCore&trade; Error:</b> An exception has been raised during Network-to-Database procedures.<br /><b>Message:</b> ".$e->getMessage().".";
       }
      }
      public function set() {
       $this->exe();
       return $this->state->fetchAll(PDO::FETCH_ASSOC);
      }
      public function single() {
       $this->exe();
       return $this->state->fetch(PDO::FETCH_ASSOC);
      }
      public function transBegin() {
       return $this->boot->beginTransaction();
      }
      public function transCancel() {
       return $this->boot->rollBack();
      }
      public function transEnd() {
       return $this->boot->commit();
      }
     }
Jordan Kasper
  • 13,153
  • 3
  • 36
  • 55

0 Answers0