Skip to content

Instantly share code, notes, and snippets.

@NitishDiwakar
Created June 24, 2017 16:49
Show Gist options
  • Save NitishDiwakar/e87223cbd30a1ff4403da47c7d871a80 to your computer and use it in GitHub Desktop.
Save NitishDiwakar/e87223cbd30a1ff4403da47c7d871a80 to your computer and use it in GitHub Desktop.
Register and login with php & mysqli using oop
<?php
// filename include/connection.php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');
define('DB_DATABASE', 'oop');
function db () {
static $conn;
if ($conn===NULL){
$conn = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
}
return $conn;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment