Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Conexion {
- private static $_dbUser = 'root';
- private static $_dbPass = 'xasasesa';
- private static $_dbDB = 'cobranzas';
- private static $_dbHost = 'localhost';
- private static $_connection = NULL;
- public static function getConnection() {
- if (!self::$_connection) { //evaluo si la conexion no esta establecida ------ self::$_connection / $this->_connection
- self::$_connection = @new mysqli(self::$_dbHost, self::$_dbUser, self::$_dbPass, self::$_dbDB); //establezco la conexion
- if (self::$_connection -> connect_error) {
- die('Connect Error: ' . self::$_connection->connect_error); //Salgo de la ejecución del programa si no logro establecer la conexion
- }
- }
- return self::$_connection; //
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement