我有一个包含20条类似的记录的数组:
{
"data":[
...
{
"DT_RowId":"row_5T20DDU5",
"accounts":{
"name":"Name of Company",
"id":"1",
...
"www":"",
"contact":""
},
"description":{
"description":""
},
"country":[
{
"iso_01":"DE",
"country":"Germany"
},
{
"iso_01":"LU",
"country":"Luxembourg"
}
]
},
],
...
"draw":1,
"recordsTotal":"20",
"recordsFiltered":"0"
}
应用一些过滤时......
<?php
...
->where( function ($u) {
if ( $_POST["id"] ) {
$u->where( 'accounts.id', $_POST["id"], '=' );
}
} )
->where( function ($v) {
if ( $_POST["iso01"] ) {
$v->where( 'country.iso_01', $_POST["iso01"], '=' );
}
} )
... accounts.id的过滤器工作正常,但不是country.iso_01。我收到一个错误:DataTables警告:table id = mytable - SQLSTATE [42S22]:找不到列:1054未知列&#39; country.iso_01&#39;在&#39; where子句&#39;。
如果值在附加方括号[]中,我如何更改iso_01过滤器?
E.g。我也在尝试这个,但错误:
$v->where( 'country[].iso_01', $_POST["iso01"], '=' );
$v->where( 'country[0].iso_01', $_POST["iso01"], '=' );