我的数据库中有一个表(PRAGMA table_info(trackedinfo);
),其中包含以下列(通过运行sendok
获得的列)
问题是即使列SELECT * FROM trackedinfo WHERE sendok IS NULL;
SELECT sendok FROM trackedinfo;
存在,当使用该字段在数据库上运行查询时,也会引发错误。
示例查询:
SQLITE_ERROR: SQL error or missing database (no such column: sendok)
错误:
sendok
但是,如果我运行查询选择所有字段,它会为我提供有关CREATE
的信息:
以下是数据库的CREATE TABLE trackedinfo
(
id INTEGER PRIMARY KEY,
date_time_start TEXT,
date_time_end TEXT,
tracked_name TEXT,
tracked_origin TEXT,
tracked_maker TEXT,
tracked_version TEXT,
tracked_type TEXT,
sendok TEXT,
tracked_id TEXT
);
命令:
tracked_id
修改
列.schema trackedinfo
编辑2
我通过执行CREATE TABLE IF NOT EXISTS "trackedinfo" ("id" INTEGER PRIMARY KEY, "date_time_start" TEXT, "date_time_end" TEXT, "tracked_name" TEXT, "tracked_origin" TEXT, "tracked_maker" TEXT, "tracked_version" TEXT, "tracked_type" TEXT, "sendok " TEXT, "tracked_id " TEXT);
<ul>
<form method="post" action="{{route('matchs.payment', ['id' => $match->id,'slug' => $match->slug])}}">
@foreach($tickets as $ticket)
<li>
<span>{{$ticket->title}}</span>
<select name="ticket[{{ $ticket->title }}]">
<option selected>0</option>
...
</select>
<span>X {{$ticket->showPrice()}}</span>
</li>
@endforeach
<li>
<span>TOTAL</span>
<span>0.00€</span>
</li>
<input type="submit" value="Go To Payment Page"/>
</form>
</ul>
答案 0 :(得分:0)
问题是我在列名的末尾有一个空格,通过删除这些空格来解决问题。
<强>之前:强>
CREATE TABLE IF NOT EXISTS "trackedinfo" ("id" INTEGER PRIMARY KEY, "date_time_start" TEXT, "date_time_end" TEXT, "tracked_name" TEXT, "tracked_origin" TEXT, "tracked_maker" TEXT, "tracked_version" TEXT, "tracked_type" TEXT, "sendok " TEXT, "tracked_id " TEXT);
<强>后:强>
CREATE TABLE IF NOT EXISTS "trackedinfo" ("id" INTEGER PRIMARY KEY, "date_time_start" TEXT, "date_time_end" TEXT, "tracked_name" TEXT, "tracked_origin" TEXT, "tracked_maker" TEXT, "tracked_version" TEXT, "tracked_type" TEXT, "sendok" TEXT, "tracked_id" TEXT);