File manager - Edit - /home/autoph/public_html/connectv1/cfg/cfg.php
Back
<?php date_default_timezone_set('Asia/Manila'); include "func.php"; class db extends functions { // The database connection protected static $connection; /** * Connect to the database * * @return bool false on failure / mysqli MySQLi object instance on success */ public function connect() { // Try and connect to the database if (!isset(self::$connection)) { // Load configuration as an array. Use the actual location of your configuration file $config = parse_ini_file('cfg.ini'); self::$connection = new mysqli($config['host'], $config['username'], $config['password'], $config['database']); self::$connection->set_charset("utf8"); self::$connection->query("SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));"); } // If connection was not successful, handle the error if (self::$connection === false) { // Handle error - notify administrator, log to a file, show an error screen, etc. return false; } return self::$connection; } /** * Fetch the last error from the database * * @return string Database error message */ public function error() { $connection = $this->connect(); return $connection->error; } }
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings