Fatal error

Alles, was MariaDB und MySQL betrifft, kann hier besprochen werden.

Fatal error

Postby davaocity » 28. February 2016 17:47

how to fix this error sir?

Code: Select all
Fatal error: Uncaught PDOException: could not find driver in C:\xampp\htdocs\phpsample\dbconnection.php:18 Stack trace: #0 C:\xampp\htdocs\phpsample\dbconnection.php(18): PDO->__construct('mysql:dbname=ph...', 'root', '') #1 C:\xampp\htdocs\phpsample\dbconnection.php(22): Database->__construct() #2 C:\xampp\htdocs\phpsample\index.php(1): require_once('C:\\xampp\\htdocs...') #3 {main} thrown in C:\xampp\htdocs\phpsample\dbconnection.php on line 18


Code: Select all
<?php

class Database extends pdo {

    private $dbtype;
    private $host;     
    private $user;
    private $pass;
    private $database;

    public function __construct(){
        $this->dbtype = 'mysql';
        $this->host = 'localhost';
        $this->user = 'root';
        $this->pass = '';
        $this->database = 'phpsample';
        $dns = $this->dbtype.':dbname='.$this->database.";host=".$this->host;
        parent::__construct( $dns, $this->user, $this->pass );
    }     
 }
   
$database = new Database();
$db =& $database;

?>
davaocity
 
Posts: 1
Joined: 28. February 2016 17:37
Operating System: windows 7

Return to MariaDB - MySQL

Who is online

Users browsing this forum: No registered users and 47 guests