Conexión BDD error
Publicado por Mauro Sánchez (1 intervención) el 23/03/2016 21:05:04
Buenas tardes a ver quien me puede ayudar ya que tengo el siguiente error.
Ya lo he revisado varias veces y no se porque sale este error.
Notice: Use of undefined constant DB_HOST - assumed 'DB_HOST' in C:\SULPI\System\PROYECTO\Aplicacion\Database.php on line 7
Notice: Use of undefined constant DB_NAME - assumed 'DB_NAME' in C:\SULPI\System\PROYECTO\Aplicacion\Database.php on line 8
Notice: Use of undefined constant DB_USER - assumed 'DB_USER' in C:\SULPI\System\PROYECTO\Aplicacion\Database.php on line 9
Notice: Use of undefined constant DB_PASS - assumed 'DB_PASS' in C:\SULPI\System\PROYECTO\Aplicacion\Database.php on line 10
Notice: Use of undefined constant DB_CHAR - assumed 'DB_CHAR' in C:\SULPI\System\PROYECTO\Aplicacion\Database.php on line 13
Warning: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Host desconocido. in C:\SULPI\System\PROYECTO\Aplicacion\Database.php on line 13
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Host desconocido.
Archivo Configuracion.php
Archivo 2 Database.php
Ya lo he revisado varias veces y no se porque sale este error.
Notice: Use of undefined constant DB_HOST - assumed 'DB_HOST' in C:\SULPI\System\PROYECTO\Aplicacion\Database.php on line 7
Notice: Use of undefined constant DB_NAME - assumed 'DB_NAME' in C:\SULPI\System\PROYECTO\Aplicacion\Database.php on line 8
Notice: Use of undefined constant DB_USER - assumed 'DB_USER' in C:\SULPI\System\PROYECTO\Aplicacion\Database.php on line 9
Notice: Use of undefined constant DB_PASS - assumed 'DB_PASS' in C:\SULPI\System\PROYECTO\Aplicacion\Database.php on line 10
Notice: Use of undefined constant DB_CHAR - assumed 'DB_CHAR' in C:\SULPI\System\PROYECTO\Aplicacion\Database.php on line 13
Warning: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Host desconocido. in C:\SULPI\System\PROYECTO\Aplicacion\Database.php on line 13
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Host desconocido.
Archivo Configuracion.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
define('BASE_URL', 'http://localhost:83/System/PROYECTO/');
define('DEFAULT_CONTROLLER', 'index');
define('DEFAULT_LAYOUT', 'default');
define('APP_NAME', 'FREMEWORK');
define('APP_SLOGAN', 'SULPI');
define('APP_COMPANY', 'www.lamar.edu.mx');
define('BD_HOST', 'localhost');
define('BD_USER', 'root');
define('BD_PASS', '');
define('BD_NAME', '_universidadlamar');
define('BD_CHAR', 'utf8');
?>
Archivo 2 Database.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
class Database extends PDO
{
public function __construct() {
parent::__construct(
'mysql:host=' . DB_HOST .
';dbname=' . DB_NAME,
DB_USER,
DB_PASS,
array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . DB_CHAR
));
}
}
?>
Valora esta pregunta


0