我发现我的错误...
我在 mySQL SELECT 查询中使用了“AS”。显然这会阻止 Datatables 正确解析响应,即使它看起来正确。
坏的:
SELECT SQL_CALC_FOUND_ROWS concat( "<input type='hidden' id='task_code' value='", t.id, "'><a href='learningguide_edit.php?task=", lg.taskID, "'><img src='../img/view_details_icon.gif' border='0'></a> ", t.title ) AS task, IF(lg.cc_standards<>'-1',LENGTH(REPLACE(lg.cc_standards, '|', '@@'))-LENGTH(lg.cc_standards)+1,0) AS CC_Count, IF(lg.state_standards<>'-1',LENGTH(REPLACE(lg.state_standards, '|', '@@'))-LENGTH(lg.state_standards)+1,0) AS State_count, IF(lg.nocti_standards<>'-1',LENGTH(REPLACE(lg.nocti_standards, '|', '@@'))-LENGTH(lg.nocti_standards)+1,0) AS NOCTI_count, IF(lg.industry_standards<>'-1',LENGTH(REPLACE(lg.industry_standards, '|', '@@'))-LENGTH(lg.industry_standards)+1,0) AS Ind_count
FROM mlg_learning_guides lg, mlg_tasklist_5 t
WHERE lg.taskID=t.id AND lg.courseID=5
好的:
SELECT SQL_CALC_FOUND_ROWS concat( "<input type='hidden' id='task_code' value='", t.id, "'><a href='learningguide_edit.php?task=", lg.taskID, "'><img src='../img/view_details_icon.gif' border='0'></a> ", t.title ), IF(lg.cc_standards<>'-1',LENGTH(REPLACE(lg.cc_standards, '|', '@@'))-LENGTH(lg.cc_standards)+1,0), IF(lg.state_standards<>'-1',LENGTH(REPLACE(lg.state_standards, '|', '@@'))-LENGTH(lg.state_standards)+1,0), IF(lg.nocti_standards<>'-1',LENGTH(REPLACE(lg.nocti_standards, '|', '@@'))-LENGTH(lg.nocti_standards)+1,0), IF(lg.industry_standards<>'-1',LENGTH(REPLACE(lg.industry_standards, '|', '@@'))-LENGTH(lg.industry_standards)+1,0)
FROM mlg_learning_guides lg, mlg_tasklist_5 t
WHERE lg.taskID=t.id AND lg.courseID=5