-
-
Save otarza/7350854 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once __DIR__ . '/config.php'; | |
function db_connect() { | |
static $conn; | |
if (empty($conn)) { | |
$conn = mysqli_connect( | |
DB_HOST, | |
DB_USER, | |
DB_PASS, | |
DB_NAME | |
); | |
} | |
return $conn; | |
} | |
function db_query($query){ | |
if($query){ | |
return mysqli_query(db_connect(),$query); | |
} | |
exit(); | |
} | |
function db_escape_string($string){ | |
if($string){ | |
return mysqli_real_escape_string(db_connect(),$string); | |
} | |
} | |
function db_close(){ | |
return mysqli_close(db_connect()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment