After reinstalling the open server, the execute() php7 method stopped working.
request:
$sql = 'SELECT count(*) as count FROM records WHERE hiddenRecord = 0'; The array entering the SqlExecute() function is empty.
processing function:
private function SqlExecute($sql = '', $array = []) { if($sql != '') { $Query = $this->Connect(); if($Query != null) { $Query->prepare($sql); foreach($array as $key => $str) { if(is_numeric($str)) { $Query->bindParam($key, $array[$key], PDO::PARAM_INT); } elseif(is_string($str)) { $Query->bindParam($key, $array[$key], PDO::PARAM_STR); } } $Query->execute(); if($Query->rowCount() > 0) { return [ 'count' => $Query->rowCount(), 'lastId' => $this->Connect()->lastInsertId(), 'result' => $Query, 'status' => true, ]; } else { return [ 'count' => 0, 'lastId' => 0, 'result' => '', 'status' => false, ]; } } } return [ 'count' => 0, 'status' => false, ]; } // Соединение. private function Connect() { static $ini__li; if($ini__li === null) { try { $ini__li = new PDO( $this->base, $this->user, $this->pass ); $ini__li->exec('SET NAMES UTF8'); } catch(PDOException $e) { $ini__li = null; } } return $ini__li; } Displayed error
Fatal error: Uncaught Error: Call to undefined method PDO :: execute ()
execstatement hasexecute. here you have an object from the first, and a method from the second - teran