first of all sorry for my english, I have a problem with my project I skip the following error when trying to connect with mysql from the index
Parse error: syntax error, unexpected 'self' (T_STRING) in C:\xampp\htdocs\app\Conexion.inc.php on line 11
How do I solve this error? I already made an adaptation to the following code http://us.php.net/manual/en/pdo.construct.php and it works to me but it is useless for my project I need to correct the one that already I put up.
I leave the files of my project thanks beforehand
Conexion.inc.php
<?php
class Conexion {
private static $conexion;
public static function abrir_conexion() {
if (!isset(self::$conexion)) {
try {
include_once 'config.inc.php'
self::$conexion = new PDO("mysql:host=$nombre_servidor; dbname=$nombre_base_datos", $nombre_usuario, $password);
self::$conexion -> setAtribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
self::$conexion -> exec("SET CHARACTER SET uft8");
print "Conexion Abierta";
} catch (PDOException $ex) {
print "ERROR: " . $ex -> getMessage() . "<br>";
die();
}
}
}
public static function cerrar_conexion() {
if (isset(self::$conexion)) {
self::$conexion = null;
print "CONEXION CERRADA";
}
}
public static function obtener_conexion() {
return self::$conexion;
}
}
index.php here is just a small code to check the connection
<?php
include_once 'app/Conexion.inc.php';
Conexion :: abrir_conexion();
Conexion :: cerrar_conexion();
?>
config.inc.php
<?php
$nombre_servidor = '127.0.0.1';
$nombre_usuario = 'root';
$password = '';
$nombre_base_datos = 'blog';