Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fatal error: Uncaught Error: Call to a member function query() on null in C:xampphtdocsa.commodulesmysql_PDO.php:44 Stack trace: #0 C:xampphtdocsa.comcontrolslist.php(20): mysql_PDO->query('SELECT * FROM s...', false) #1 C:xampphtdocsa.comindex.php(140): list_control->start() #2 {main} thrown in C:xampphtdocsa.commodulesmysql_PDO.php on line 44
- class list_control
- {
- private $lang;
- function __construct($lang)
- {
- $this->lang = $lang;
- loadModule('mysql_PDO');
- }
- public function start() {
- global $dbc;
- $db = new mysql_PDO($dbc['host'], $dbc['user'], $dbc['password'], $dbc['dbase']);
- $db->connect();
- $db->query('SELECT * FROM slug', false);
- load('list', $this->lang);
- $db = null;
- }
- }
- class mysql_PDO
- {
- private $host;
- private $user;
- private $password;
- private $dbase;
- private $char;
- public $db;
- function __construct($host, $user, $password, $dbase, $char = 'UTF8mb4')
- {
- $this->host = $host;
- $this->user = $user;
- $this->password = $password;
- $this->dbase = $dbase;
- $this->char = $char;
- function clearStr($str) {
- $str = htmlspecialchars(trim(mysqli_real_escape_string($str)));
- return $str;
- }
- }
- public function connect() {
- $db = new PDO('mysql:host='.$this->host.';dbname='.$this->dbase.'', $this->user, $this->password) or die();
- $db->exec('SET NAMES '.$this->char.'');
- }
- public function query($query, $bool = false) {
- $result = $this->db->query($query); //ВОТ 44 СТРОКА
- $result->execute();
- if ($bool == false) {
- $return = $result->fetchAll();
- return $return;
- } else {
- return $result;
- }
- }
- public function close() {
- $this->db = null;
- }
- }
Add Comment
Please, Sign In to add comment