我正在修改在Wampserver上创建的WebApp。我想在页面CustomerData/Create.中添加一些选项,比如一个名为‘some’的下拉列表
在fields.yaml上添加代码之后:
district:
label: 'District'
options:
Ab: Aberdeen
Ad: Admiralty
Ap: Ap Lei Chau
Ca: Causeway Bay
Ce: Central
H: Happy Valley
K: Kowloon
M: Mid Levels
N: North Point
Pe: Peak
Po: Pok Fu Lam
Q: Quarry Bay
Sa: Sai Ying Pun
Sh: Sheung Wan
Ta: Taikoo Shing
Ti: Tin Hau
Wa: Wan Chai
Wo: Wong Chuk Hang
NT: NT
span: left
required: 1
type: dropdown
tab: 'Contact Information'在MySQL工作台上,我加入“分区”为ENUM(“九龙”、“中环”、“北角”、“鱼涌”、“太古城”、“天后”、“湾仔”、“跑马地”、“西营盘”、“中层”、“上环”、“薄扶林”、“金钟”、“坚地城”、“鸭洲”、“山顶”、“黄竹坑”、“新界”、“铜锣湾”)。
然而,我有以下错误:
SQL 010000:警告:125个数据被截断,列‘区’在第1行(SQL:插入.在C:\wamp64...\Database\Connection.php的第664行)
下面是第664行的Connection.php代码:
protected function runQueryCallback($query, $bindings, Closure $callback)
{
// To execute the statement, we'll simply call the callback, which will actually
// run the SQL against the PDO connection. Then we can calculate the time it
// took to execute and log the query SQL, bindings and time in our memory.
try {
$result = $callback($query, $bindings);
}
// If an exception occurs when attempting to run a query, we'll format the error
// message to include the bindings with SQL, which will make this exception a
// lot more helpful to the developer instead of just the database's errors.
catch (Exception $e) {
throw new QueryException(
$query, $this->prepareBindings($bindings), $e
);
}
return $result;
}如何修复此错误?
发布于 2019-07-08 03:19:52
当插入未被具体枚举的ENUM值时,您将得到Data truncated for column...错误(如在创建列时插入的特定ENUM选项之一)。
在您的options:文件中,您的fields.yaml文件遵循=>标签格式;这意味着冒号前面的值应该是实际的枚举值(即九龙或中央),然后是下拉菜单使用的实际标签。
https://stackoverflow.com/questions/56927808
复制相似问题