如何添加许多字段到下面查询的搜索按钮wordpress


How to add many fields to search button for the below query-wordpress

我无法为搜索按钮查询添加许多字段

搜索查询应基于名称或application_id或公司或国家/地区。

如果我根据任何一个标准进行搜索,它应该会给我结果。

下面是我的代码

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....

但最终没有结果。

您还必须多次传递参数:

"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