SQLite3/PDO-尽管确实存在此类表 [英] SQLite3 / PDO - No such table though it does exist

查看:78
本文介绍了SQLite3/PDO-尽管确实存在此类表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个SQLite3数据库问题,我可以使用sqlite3命令或PHPStorm内置数据库管理器访问它,但是我正在处理的应用程序在其中找不到表.它似乎可以正确连接到数据库.

I have a problem with an SQLite3 database where I can access it either with the sqlite3 command or with the PHPStorm built-in database manager but the application I am working on doesn't find the tables in it. It correctly connects to the database it seems.

这行PHP会导致PDOException:

This line of PHP causes the PDOException:

$query = "SELECT * FROM users";
$results = self::$app->db->query($query);

唯一的例外是SQLSTATE[HY000]: General error: 1 no such table: users.顺便说一下,我正在使用Slim框架.

And the exception is simply SQLSTATE[HY000]: General error: 1 no such table: users. I am using the Slim framework, by the way.

我真的不知道该怎么做,因为我是Slim和SQLite的新手.

I don't really know what to do as I am new to Slim as well as SQLite.

谢谢您的帮助:-)

推荐答案

您打开的数据库不包含该表.

The database that you have opened does not contain this table.

SQLite会很高兴地打开任何文件名;如果它不存在,它将创建一个新的空数据库.

SQLite will happily open any file name; if it does not exist, it will create a new, empty database.

检查您的数据库文件名.

Check your database file name.

这篇关于SQLite3/PDO-尽管确实存在此类表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆