Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 数据库表被锁定了吗?_Php_Sqlite - Fatal编程技术网

Php 数据库表被锁定了吗?

Php 数据库表被锁定了吗?,php,sqlite,Php,Sqlite,PHP版本:5.5,SQLite版本:3.8 我使用的代码是: try { $dbh = new PDO('sqlite:'.MF_DB_PATH.MF_DB_FILE); $dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); } catch(PDOException $e) { $error_connecting = "Error connecting to the data

PHP版本:5.5,SQLite版本:3.8

我使用的代码是:

try {
      $dbh = new PDO('sqlite:'.MF_DB_PATH.MF_DB_FILE);
      $dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
} catch(PDOException $e) {
      $error_connecting =  "Error connecting to the database: ".$e->getMessage();
      $pre_install_error = $error_connecting;
}

$query = "INSERT INTO forms_backup SELECT * FROM forms;";
$params = array();
$sth = $dbh->prepare($query);
try{
    $sth->execute($params);
}catch(PDOException $e) {
    $post_install_error .= $e->getMessage().'<br/><br/>';
}

$query = "DROP TABLE forms;";
$params = array();
try{
    $sth->execute($params);
}catch(PDOException $e) {
    $post_install_error .= $e->getMessage().'<br/><br/>';
}
试试看{
$dbh=new PDO('sqlite:'.MF_DB_PATH.MF_DB_文件);
$dbh->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_异常);
}捕获(PDO$e){
$error_connecting=“连接到数据库时出错:”..e->getMessage();
$pre_install_error=$error_connecting;
}
$query=“插入表单\u备份从表单中选择*”;
$params=array();
$sth=$dbh->prepare($query);
试一试{
$sth->execute($params);
}捕获(PDO$e){
$post_install_error.=$e->getMessage()。

; } $query=“DROP TABLE forms;”; $params=array(); 试一试{ $sth->execute($params); }捕获(PDO$e){ $post_install_error.=$e->getMessage()。

; }
错误消息:

SQL:[20]删除表格表格;参数:0查询失败:
SQLSTATE[HY000]:一般错误:6数据库表已锁定


请共享您的数据库模式当您试图删除将与其他资源一起使用的表时,可能会出现错误找到解决方案了吗?