當前位置: 首頁>>代碼示例>>PHP>>正文


PHP mysqli::__construct方法代碼示例

本文整理匯總了PHP中mysqli::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP mysqli::__construct方法的具體用法?PHP mysqli::__construct怎麽用?PHP mysqli::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mysqli的用法示例。


在下文中一共展示了mysqli::__construct方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct($host, $user, $pass, $db)
 {
     parent::__construct($host, $user, $pass, $db);
     if (mysqli_connect_error()) {
         die('No se pudo conectar a la base de datos (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
     }
 }
開發者ID:querquobad,項目名稱:sol_empleo,代碼行數:7,代碼來源:mysql_db.php

示例2: abrir

 public function abrir()
 {
     parent::__construct($dbhost = 'p:localhost', $dbuser = 'root', $dbpass = '12345', $dbname = 'usuario');
     $this->connect_errno ? die('Error con la conexión') : ($x = 'Conectado');
     //echo $x;
     unset($x);
 }
開發者ID:robertw1905,項目名稱:CRUD_Usuario_MySQL,代碼行數:7,代碼來源:class.Conexion.php

示例3: __construct

 public function __construct()
 {
     parent::__construct('localhost', 'root', '', 'xnova');
     $this->query("SET NAMES utf8;");
     date_default_timezone_set('America/Caracas');
     $this->connect_errno ? die('ERROR: Datos incorrectos en /core/models/class.Connect.php') : null;
 }
開發者ID:Nykus,項目名稱:xnova,代碼行數:7,代碼來源:class.Connect.php

示例4: __construct

 public function __construct($host, $user, $password, $database)
 {
     $link_id = @parent::__construct($host, $user, $password, $database);
     if (mysqli_connect_error()) {
         die('<b>Fehler beim Verbinden!</b><br>Connect Errno: ' . mysqli_connect_errno() . '<br>Connect Error: ' . mysqli_connect_error());
     }
 }
開發者ID:Wehmeyer,項目名稱:Litotex-0.7,代碼行數:7,代碼來源:class_db_mysqli.php

示例5: __construct

 public function __construct($host = false, $user = false, $pass = false, $dbname = "", $port = false, $socket = false)
 {
     if ($host === false && $socket === false) {
         $host = ini_get("mysqli.default_host");
     }
     if ($user === false) {
         $user = ini_get("mysqli.default_user");
     }
     if ($pass === false) {
         $pass = ini_get("mysqli.default_pw");
     }
     if ($port === false) {
         $port = ini_get("mysqli.default_port");
     }
     if ($socket === false && $host === false) {
         $socket = ini_get("mysqli.default_socket");
     }
     parent::__construct($host, $user, $pass, $dbname, $port, $socket);
     if ($this->connect_error) {
         throw new Expection('mysqlii: Connect Error (' . $this->connect_errno . ') ' . $this->connect_error);
     }
     #initialise the connection for killing queries
     $this->killConnection = new mysqli($host, $user, $pass, $dbname, $port, $socket);
     if ($this->killConnection->connect_error) {
         throw new Expection('mysqlii: Connect Error in Kill Connection (' . $this->killConnection->connect_errno . ') ' . $this->{$killConnection}->connect_error);
     }
 }
開發者ID:vrtulka23,項目名稱:daiquiri,代碼行數:27,代碼來源:mysqlii.php

示例6: __construct

 /**
  * Adb constructor.
  *
  * Function to establish a connection each time
  * the adb class is instantiated. The constructor
  * takes in the host, username, password, the name
  * of the database and the port as its parameters
  *
  * @internal param string $host
  * @internal param string $username
  * @internal param string $passwd
  * @internal param string $dbname
  * @internal param int $port
  */
 public function __construct()
 {
     parent::__construct(DB_HOST, DB_USER, DB_PWORD, DB_NAME, DB_PORT);
     if (mysqli_connect_error()) {
         die('Connection Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
     }
 }
開發者ID:fredrickabayie,項目名稱:WineStore,代碼行數:21,代碼來源:adb.php

示例7: die

 function __construct($host, $user, $pass, $db)
 {
     parent::__construct($host, $user, $pass, $db);
     if ($this->connect_error) {
         die('Connect Error (' . $this->connect_errno . ') ' . $this->connect_error);
     }
 }
開發者ID:RamadhanAmizudin,項目名稱:WPCF,代碼行數:7,代碼來源:init.php

示例8: __construct

 private function __construct()
 {
     @parent::__construct(core_settings::i()->get('CONFIG_SERVERS_DATABASE_IP'), core_settings::i()->get('CONFIG_SERVERS_DATABASE_USERNAME'), core_settings::i()->get('CONFIG_SERVERS_DATABASE_PASSWORD'), core_settings::i()->get('CONFIG_SERVERS_DATABASE_DATABASE'), core_settings::i()->get('CONFIG_SERVERS_DATABASE_PORT'));
     if ($this->connect_errno) {
         throw new Exception("Cannot Connect to Database: " . $this->connect_error);
     }
 }
開發者ID:optiva,項目名稱:xGlide,代碼行數:7,代碼來源:core_database.php

示例9:

 /**
  * @name __construct
  * @param $host host for the mysql connection
  * @param $user user for the mysql connection
  * @param @pass password for the mysql connection
  * @param $db schema to work with
  * @param $port port for the mysql connection
  * @param $socket socket for the mysql connection
  **/
 function __construct($host = 'localhost', $user = null, $pass = null, $db = null, $port = null, $socket = null)
 {
     @parent::__construct($host, $user, $pass, $db, $port, $socket);
     if ($this->connect_errno != 0) {
         $this->build_error('connect');
     }
 }
開發者ID:alexu84,項目名稱:myframework,代碼行數:16,代碼來源:mf.mysqli.php

示例10: __construct

 public function __construct($options = array())
 {
     $default = array('mysql_data' => NULL, 'repertoire' => '/');
     $options = array_merge($default, $options);
     extract($options);
     $this->host = $mysql_data['host'];
     $this->port = $mysql_data['port'];
     $this->user = $mysql_data['user'];
     $this->pass = $mysql_data['pass'];
     $this->bdd = $mysql_data['bdd'];
     $this->socket = $mysql_data['socket'];
     $this->charset = $mysql_data['charset'];
     $this->collation = $mysql_data['collation'];
     $this->data_directory = $mysql_data['data_directory'];
     @parent::__construct($this->host, $this->user, $this->pass, $this->bdd, $this->port, $this->socket);
     if ($this->connect_error) {
         $this->bkp_errors[] = 'Une erreur s\'est produite lors de la connexion aux bases de données';
         return;
     }
     $this->repertoire = $repertoire;
     if (!is_dir($this->repertoire)) {
         $this->bkp_errors[] = 'Une erreur s\'est produite lors l\'accès au répertoire &laquo; ' . htmlspecialchars($this->repertoire) . ' &raquo;';
         return;
     }
     $this->nom_fichier = $this->bdd . '.sql';
     $this->fichier = @fopen($this->repertoire . $this->nom_fichier, 'w');
     if (!$this->fichier) {
         $this->bkp_errors[] = 'Une erreur s\'est produite lors de l\'écriture du fichier &quot;' . htmlspecialchars($this->nom_fichier) . '&quot;';
         return;
     }
     $this->generer();
     $this->bkp_errors = array();
 }
開發者ID:benyounesmehdi,項目名稱:MBackuper,代碼行數:33,代碼來源:mysqli_bkp.inc.php

示例11: __construct

 public function __construct()
 {
     parent::__construct(HOST, NOMUSUARI, CONTRASENYA, NOMBDD);
     if (mysqli_connect_error()) {
         die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
     }
 }
開發者ID:AniMasterOnline,項目名稱:AniMaster,代碼行數:7,代碼來源:config.php

示例12: __construct

 public function __construct($host, $username, $password, $database)
 {
     parent::__construct("{$host}", "{$username}", "{$password}", "{$database}");
     if (mysqli_connect_error()) {
         die('Could not connect: ' . mysqli_connect_error());
     }
 }
開發者ID:Xackery,項目名稱:EQEmuEOC,代碼行數:7,代碼來源:mysqli.php

示例13: __construct

 /**
  * Constructeur
  * @param array $options
  */
 public function __construct($options = array())
 {
     $default = array('host' => ini_get('mysqli.default_host'), 'username' => ini_get('mysqli.default_user'), 'passwd' => ini_get('mysqli.default_pw'), 'dbname' => '', 'port' => ini_get('mysqli.default_port'), 'socket' => ini_get('mysqli.default_socket'), 'dossier' => './sql/', 'nbr_fichiers' => 5, 'nom_fichier' => 'backup_');
     $options = array_merge($default, $options);
     extract($options);
     // Connexion de la connexion DB
     @parent::__construct($host, $username, $passwd, $dbname, $port, $socket);
     if ($this->connect_error) {
         $this->message('Erreur de connexion (' . $this->connect_errno . ') ' . $this->connect_error);
         return;
     }
     // Controle du dossier
     $this->dossier = $dossier;
     if (!is_dir($this->dossier)) {
         $this->message('Erreur de dossier &quot;' . htmlspecialchars($this->dossier) . '&quot;');
         return;
     }
     // Controle du fichier
     $this->nom_fichier = $nom_fichier . date('Ymd-His') . '.sql.gz';
     $this->gz_fichier = @gzopen($this->dossier . $this->nom_fichier, 'w');
     if (!$this->gz_fichier) {
         $this->message('Erreur de fichier &quot;' . htmlspecialchars($this->nom_fichier) . '&quot;');
         return;
     }
     // Demarrage du traitement
     $this->sauvegarder();
     $this->purger_fichiers($nbr_fichiers);
 }
開發者ID:ctariel,項目名稱:CyberGestionnaireLGB,代碼行數:32,代碼來源:backup.php

示例14: __construct

 private function __construct()
 {
     parent::__construct(DB_HOST, DB_USER, DB_PASS, DB_NAME);
     if (mysqli_connect_errno()) {
         throw new Exception(mysqli_connect_error(), mysqli_connect_errno());
     }
 }
開發者ID:byronwall,項目名稱:runnDAILY,代碼行數:7,代碼來源:database.php

示例15: die

 function __construct()
 {
     parent::__construct("henrikh.dyndns.org", "webprosjekt", "web123", "web_prosjekt", "3306");
     if (mysqli_connect_error()) {
         die("Kunne ikke opprette tilkobling til databasen: (" . mysqli_connect_errno() . ") " . mysqli_connect_error());
     }
 }
開發者ID:henrikhermansen,項目名稱:Webprogprosjekt,代碼行數:7,代碼來源:sql.php


注:本文中的mysqli::__construct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。