Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $con = getCon();
- $result = mysqli_query($con, "SELECT * FROM sometable WHERE deleted=0");
- class Database {
- private static $db;
- private $connection;
- private function __construct() {
- $servername = "localhost";
- $username = "...";
- $password = "...";
- $dbname = "...";
- $this->connection = new mysqli($servername, $username, $password, $dbname);
- }
- function __destruct() {
- $this->connection->close();
- }
- public static function getConnection() {
- if(self::$db == null) {
- self::$db=new Database();
- }
- return self::$db->connection;
- }
- }
- $con = getCon();
- $result = $con->query("SELECT * FROM sometable WHERE deleted=0");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement