Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;<?php
- ;die(); // /* No modificar sino sabe lo que hace */
- ;/*
- [database]
- driver="mysql"
- host="localhost"
- port="3306"
- schema="h_sancion"
- username="root"
- password=""
- ;*/
- <?php
- $file = '__config.ini.php';
- $config = parse_ini_file($file, true);
- $host = $config['database']['host'];
- $user = $config['database']['username'];
- $pass = $config['database']['password'];
- $schema = $config['database']['schema'];
- class conexion extends mysqli
- {
- public
- function __construct($host, $user, $pass, $schema)
- {
- parent::__construct($host, $user, $pass, $schema);
- if (mysqli_connect_error())
- {
- die();
- }
- }
- }
- $conexion = new conexion($host, $user, $pass, $schema);
- ?>
- <?php
- $file = 'config.ini.php';
- $config = parse_ini_file($file, true);
- $host = $config['database']['host'];
- $user = $config['database']['username'];
- $pass = $config['database']['password'];
- $schema = $config['database']['schema'];
- $encode = $config['database']['encode'];
- class conexion extends mysqli
- {
- public
- function __construct($host, $user, $pass, $schema)
- {
- parent::__construct($host, $user, $pass, $schema);
- if (mysqli_connect_error())
- {
- die();
- }
- }
- }
- $conexion = new conexion($host, $user, $pass, $schema);
- mysqli_set_charset( $conexion, $encode);
- ?>
- ;<?php
- ;die(); // /* No modificar sino sabe lo que hace */
- ;/*
- [database]
- driver="mysql"
- host="localhost"
- port="3306"
- schema="bbdd"
- username="root"
- password="pass"
- encode="utf8"
- ;*/
- /* cambiar el conjunto de caracteres a utf8 */
- if (!$mysqli->set_charset("utf8")) {
- printf("Error cargando el conjunto de caracteres utf8: %sn", $mysqli->error);
- exit();
- } else {
- printf("Conjunto de caracteres actual: %sn", $mysqli->character_set_name());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement