当前位置: 首页>>代码示例>>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;未经允许,请勿转载。