PHP error with PDO and SQLITE, Call to a Member Function execute() on bool

Asked

Viewed 55 times

2

Hello, can anyone see why this error is apparently all right

function verificarImportados(){

define("DB_DSN", "sqlite:host=localhost;dbname=dbXML.db");
define("DB_USERNAME", " ");
define("DB_PASSWORD", " ");

try{
    $conn = new PDO(DB_DSN, DB_USERNAME, DB_PASSWORD);
    $stmt = $conn->prepare("SELECT id,xml,vizualized FROM xmlbase");
    $stmt->execute();
    $results = $stmt->fetchALL(PDO::FETCH_ASSOC);

    foreach ($results as $row) {
        foreach ($row as $key => $value) {

            echo "<strong>" .$key . ":</strong>" .$value ."<br />";
        }
        echo "===================================================<br>";
    }
} catch (PDOException $e) {
        echo 'Falha na conexão: ' . $e->getMessage();
    }
}
verificarImportados();

Error generated

inserir a descrição da imagem aqui

Bank code

    --
-- File generated with SQLiteStudio v3.2.1 on sex dez 13 11:50:14 2019
--
-- Text encoding used: System
--
PRAGMA foreign_keys = off;
BEGIN TRANSACTION;

-- Table: xmlbase
CREATE TABLE xmlbase (id INTEGER PRIMARY KEY ASC AUTOINCREMENT NOT NULL, xml INTEGER NOT NULL, vizualized STRING);
INSERT INTO xmlbase (id, xml, vizualized) VALUES (1, 123, 'vizualized');
INSERT INTO xmlbase (id, xml, vizualized) VALUES (2, 1232, 'vizualized');

COMMIT TRANSACTION;
PRAGMA foreign_keys = on;

The following lines are uncommented in my PHP.ini

Extension=pdo_sqlite Extension=sqlite3

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.