Thread: PDO addon
View Single Post
  #5  
Old 23rd November 2018, 03:37
BamBam0077 BamBam0077 is offline
Banned
 
Join Date: Jul 2013
P2P
Posts: 410
Default
Code:
  function setupDatabase()
    {
        // put your database information mentioned above here
        $username = 'root';
        $password = 'root';
        $host = 'localhost';
        $dbname = 'verify';

        try {
            $pdo = new PDO("mysql:host=$host;dbname=$dbname",$username,$password);
            $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        } catch(PDOException $e) {
            return 'ERROR: ' . $e->getMessage();
        }

        return $pdo;
    }
Reply With Quote