I'm having problems with the PDO connection to the mysql database.
Database_connection.php :
<?php
class Database_connection {
private $db_host = "local";
private $db_name = "root";
private $db_user = "user";
private $db_pass = "pass";
protected $db_holder;
protected function open_connection() {
$this->db_holder = new PDO($this->db_host.$this->db_name, $this->db_user, $this->db_pass);
}
protected function close_connection() {
$this->db_holder = null;
}
}
?>
You are returning this error when trying to login with username and password:
Fatal error: Uncaught exception 'PDOException' with message 'invalid data source name 'in Database_connection.php: 11 Stack trace:
/Database_connection.php(11): PDO-> constructor ('local', 'user', 'pass') /iis_functions_home.php (9): Database_connection-> open_connection () /log_in_validation.php (13): Iis_functions_home-> check_username ('username', 'password') # 3 {main} thrown in /Database_connection.php on line 11
Do I need to post any more code? Or is the problem only in the connection with the database?