我无法为搜索按钮查询添加许多字段
搜索查询应基于名称OR application_id OR company OR country。
如果我根据任何标准进行搜索,它应该给我结果。
以下是我的代码
SELECT * FROM $table_name WHERE name LIKE %s ORDER BY $orderby $order LIMIT %d OFFSET %d",'%'.$_POST['s'].'%',$per_page, $paged
尝试:
SELECT * FROM $table_name WHERE name LIKE %s OR Application_ID LIKE %s OR Country LIKE %s ORDER BY $orderby $order LIMIT %d OFFSET %d",'%'.$_POST['s'].'%',$per_page, $paged....
但结果没有结果。
答案 0 :(得分:1)
您还必须多次传递参数:
"SELECT * FROM $table_name WHERE name LIKE %s
OR Application_ID LIKE %s OR Country LIKE %s
ORDER BY $orderby $order
LIMIT %d OFFSET %d", '%'.$_POST['s'].'%', '%'.$_POST['s'].'%',
'%'.$_POST['s'].'%', $per_page, $paged