The following block of code is not working to do what it is meant to do.
I have confirmed that the DELETE statement (in the second line) works directly on the command line for sqlite3 where OutputID = 1
$myPDO = new PDO("sqlite:$dbpath");
$stmt = $myPDO->prepare("DELETE FROM Output WHERE ID = :OutputID");
$stmt->bindParam(':OutputID', $OutputID, PDO::PARAM_INT);
$stmt->execute();
echo $stmt->rowCount();
Expected result is 1 but I get 0
The error (gotten by capturing $myPDO->errorInfo(); which returns an array) was that the database was read-only, so I moved the database file into a directory with 777 permissions (I am working in Linux environment, by the way) and changed the permissions of the database file to 777 also. I modified the database path in the code accordingly and now it works!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.