I am creating a database class in PHP but I feel that there's something wrong with my code. Is there any suggestion to refactor this? I feel like there's something wrong and missing in this code.
<?php
require_once("db_constants.inc.php");
Class MySqli_Database
{
public $db;
public function __construct($db_host,$db_username,$db_password,$db_name)
{
$this->db = new mysqli($db_host,$db_username,$db_password,$db_name);
}
public function __performSql($sql)
{
}
public static function closeConnection($conn)
{
$this->db_close();
}
}
$conn = new MySqli_Database (DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME)
or die("Could Not Connect To Database: " . mysqli_errno());
Perform SQL will just basically execute the query, though I haven't included the code yet, but I will soon. Also if you have tutorials or guide when creating a database class for MySQLi please post it. It would be a great help.