我想使我的表可以在每列中過濾。我從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