PDO: sqlite does not contain INSERT data, but no error

try
{
    $res = $db->exec($sql);
    if ($res === FALSE)
    {
        print_r($db->errorInfo());
        die();
    }
}
catch(PDOException $e)
{
    die($e->getCode().':'.$e->getMessage());
}
catch(Exception $e)
{
    die($e->getCode().':'.$e->getMessage());
}    

There is no error information, and it also does not fall as an exception. However, $ res is FALSE and no data is inserted.

Array
(
    [0] => 
)

But when I echo $sqland enter this query into SQLiteManager, it inserts data.

+1
source share
2 answers

I used sqlite only with Python, but I had to do insert / update instructions there ... Maybe here and here? http://docs.php.net/manual/en/pdo.commit.php

+1
source

Make sure that the directory in which you store the file is writable.

+1
source

Source: https://habr.com/ru/post/1784276/


All Articles