sqlite 错误没有这样的列
这里有人对这个错误有一些经验吗?
仅当我使用 WHERE 子句时,才会出现此错误。
我使用 php PDO 来获取结果。
这是我的简单表
$sql = "CREATE TABLE samenvatting (
stem_id INTEGER PRIMARY KEY AUTOINCREMENT,
poll_id TEXT,
stem_waarde_id TEXT,
totaal INTEGER
)";
$crud->rawQuery($sql);
$poll_id = "somepoll";
$records = $crud->rawSelect('SELECT * FROM samenvatting WHERE poll_id='.$poll_id);
pdo 抽象类
public function conn()
{
isset($this->username);
isset($this->password);
if (!$this->db instanceof PDO)
{
$this->db = new PDO($this->dsn, $this->username, $this->password);
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
}
public function rawSelect($sql)
{
$this->conn();
return $this->db->query($sql);
}
谢谢,理查德
Does anyone here have some experience with this error?
Only If I use the WHERE clause, I get this error.
I use php PDO to get the results.
And this is my simple table
$sql = "CREATE TABLE samenvatting (
stem_id INTEGER PRIMARY KEY AUTOINCREMENT,
poll_id TEXT,
stem_waarde_id TEXT,
totaal INTEGER
)";
$crud->rawQuery($sql);
$poll_id = "somepoll";
$records = $crud->rawSelect('SELECT * FROM samenvatting WHERE poll_id='.$poll_id);
pdo abstract class
public function conn()
{
isset($this->username);
isset($this->password);
if (!$this->db instanceof PDO)
{
$this->db = new PDO($this->dsn, $this->username, $this->password);
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
}
public function rawSelect($sql)
{
$this->conn();
return $this->db->query($sql);
}
Thanks, Richard
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它将“somepoll”视为表中的一列。您需要引用它,因为它被声明为文本。 也许是这样
?
It is treating "somepoll" as a column in the table. You need to quote it, since it is declared as text. Something like
perhaps?