Loading...
PHP/MySQL | Помогите исправить
Пиши подключение к бд на php опп
вот ошибка
Fatal error: Call to a member function fetch_assoc() on a non-object in Z:\home\test1.ru\www\lib\db.php on line 32
Вот код
plaintext

<?php
class db {
    
    public function __construct() {
        $this->mysqli = new mysqli('localhost', 'blog', '123456a','blog');
    }
    
    public function query($sql){
        //$db->query("SELECT * FROM adlkd WHERE id = ?",$id);
        $args = func_get_args();
        $sql = array_shift($args);
        $link = $this->mysqli;
        $areg = array_map(function($param) use ($link){
            return $link->escape_string($param);
        },$args);
        
        $sql = str_replace(array('%','?'), array('%%','?s'), $sql);
        
        array_unshift($args, $sql);
        
        $sql = call_user_func_array('sprintf', $args);
        
        $this->late = $this->mysqli->query($sql);
        if ($this->last === false) {
            throw new Exception('Database error:' . $this->mysqli->error);
        }
        return $this;
        
    }
    
    public function assoc(){
        return $this->last->fetch_assoc();
    }
    
}
Данные от бд .ыы.
Tereschuk (18.10.2017 в 23:52)
Данные от бд .ыы.
пофиг я на локалке делаю
Онлайн: 1
Время:
Gen. 0.0817
(c) Bym.Guru 2010-2026