Skip to content

Instantly share code, notes, and snippets.

@Uman88
Created August 28, 2022 14:47
Show Gist options
  • Select an option

  • Save Uman88/68f5d71b98f5070e389a23915878c7c2 to your computer and use it in GitHub Desktop.

Select an option

Save Uman88/68f5d71b98f5070e389a23915878c7c2 to your computer and use it in GitHub Desktop.
[DB mysqli] Простой класс, для мелких сайтов #DB #class
class DB
{
public $conn;
private $dbHost;
private $dbUser;
private $dbPass;
private $dbName;
public function __construct()
{
$this->dbHost = 'localhost';
$this->dbUser = 'root';
$this->dbPass = '';
$this->dbName = 'php-store';
$this->conn = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName);
if (!$this->conn) {
echo 'DB Connection Error ' . mysqli_connect_error($this->conn);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment