есть класс user
есть класс db
есть класс configs
user extends db (в свою очередь) extends configs
User:
class User extends DB {
private $username;
private $fname;
private $sname;
private $about;
private $city;
private $sex;
private $age;
private $password;
private $email;
private $last_login;
private $logins;
private $mood;
private $last_active;
private $uniq;
public function user_create()
{
$this->insert();
}
}
DB:
class DB extends Configs {
private $connect;
private $host;
private $username;
private $password;
private $dbname;
function __construct()
{
$db_set = $this->db_settings();
$this->host = $db_set['host2'];
$this->username = $db_set['username'];
$this->password = $db_set['password'];
$this->dbname = $db_set['dbname'];
$this->connect();
print_r('вызван конструктор <br>');
}
function connect()
{
$this->connect = new mysqli($this->host , $this->username, $this->password, $this->dbname);
$this->connect->set_charset('utf8');
print_r('вызван connect <br>');
}
function insert()
{
$stmt = $this->connect->prepare('INSERT INTO users (username) VALUES (:s)');
$stmt->bind_param('s', 'test');
$stmt->execute();
$stmt->close();
print_r('insert <br>');
}
}
конфигс ничего такого примечательного не делает.
У меня лезет вот такая ошибка Call to a member function bind_param() on a non-object
это когда вызываю
user_create()