Warning: mysqli :: mysqli (): in C: \ xampp \ htdocs \ engine \ classes \ bd.Class.php on line 4

I have a problem with my extends class for mysqli connections. I don't understand how to extend the mysqli construct in my Logare class. Here I want to check the connection, but It is showing these errors. My bd file is bd.Class.php

<?php
class ConectareBd{
    function __construct(){
        $bd = new mysqli('localhost', 'root', '', 'test');
        $bd->set_charset("utf8");
        echo "xzxzxcxd";
    }
}
?>

      

logare.Class.php

<?php
require_once('bd.class.php');
class Logare extends ConectareBd{
    function __construct(){
        parent::__construct();
    }
}
?>

      

and index.php

<?php require_once('/engine/classes/logare.Class.php'); 
$Log = new Logare;
?>

      

How can I fix these errors from index.php:

Warning: mysqli::mysqli(): in C:\xampp\htdocs\engine\classes\bd.Class.php on line 4

Warning: mysqli::set_charset(): Couldn't fetch mysqli in C:\xampp\htdocs\engine\classes\bd.Class.php on line 5
xzxzxcxd

      

Thank!

+3


source to share





All Articles