我想使我的表可以在每列中过滤。我从DataTable.net获得客户端脚本。为了做到这一点,我必须在服务器端脚本中修改这个数据表。我的表格字段是:行,型号名称,版本,批号,序列号,ID号,批号_序列号和产品日期。datatable:使服务器端脚本过滤每列
我试图将每列同步到这个服务器脚本,但我总是得到一个错误。 这下面的脚本:
sSearch:
bEscapeRegex:true
sSearch_0:
bEscapeRegex_0:true
bSearchable_0:true
sSearch_1:
bEscapeRegex_1:true
bSearchable_1:true
sSearch_2:
bEscapeRegex_2:true
bSearchable_2:true //data array same until sSearch_7
编辑
这个查询:
$sWhere = "";
if (postVar('sSearch') !="")
{
$sWhere = " WHERE Line LIKE '%".mysql_real_escape_string($_POST['sSearch'])."%' ";
}
if (postVar('sSearch_0') !="")
{
$sWhere = " AND Line LIKE '".mysql_real_escape_string($_POST['sSearch_0'])."' ";
}
if (postVar('sSearch_1') !="")
{
$sWhere = " AND Model_name LIKE '%".mysql_real_escape_string($_POST['sSearch_1'])."%' ";
//直到sSearch_7
我在这个查询得到错误:
error: "Error occuered during query execution:(): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND Line LIKE '2' ORDER BY Model_name desc LIMIT 0, 10' at line 1";
谢谢我错过了concat。 – klox 2010-09-25 02:33:29