lundi 22 février 2016

SQLite - PDOException: invalid data source name

I am using SQLite with PHP for the first time. I am trying to get data from contact.s3db. Bu I am getting an error like this: Fatal error: Uncaught exception 'PDOException' with message 'invalid data source name' in... Here is my code:

$dir = 'contact.s3db';
$dbh  = new PDO($dir) or die("cannot open the database");
$query =  "SELECT * FROM person";
foreach ($dbh->query($query) as $row)
{
    echo $row[1] . " " . $row[2] . "<br />";
}

Aucun commentaire:

Enregistrer un commentaire