Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress查询具有多个和IN where子句的IN运算符_Php_Wordpress - Fatal编程技术网

Php Wordpress查询具有多个和IN where子句的IN运算符

Php Wordpress查询具有多个和IN where子句的IN运算符,php,wordpress,Php,Wordpress,我需要一个带有multiple和IN-where子句的IN运算符的WordPress查询 $query="SELECT event FROM $wpdb->prifix.wp_rsvpmaker rsvp WHERE user_id IN ($format) AND event != %d UNION ALL SELECT eventid FROM $wpdb->prifix.wp_payment_event WHERE pay_user_id IN($format) AND e

我需要一个带有multiple和IN-where子句的IN运算符的WordPress查询

$query="SELECT  event FROM $wpdb->prifix.wp_rsvpmaker rsvp WHERE user_id IN ($format) AND event != %d
UNION ALL 
SELECT eventid
FROM $wpdb->prifix.wp_payment_event WHERE pay_user_id IN($format) AND eventid !=%d";

$value[]=$usersRegisteFrOtherEvents;
$value[]=$eventid;
$value[]=$usersRegisteFrOtherEvents;
$value[]=$eventid;

$eventIDs = $wpdb->get_results($wpdb->prepare($query,$value),ARRAY_A);

尝试使用此代码,确保在传递到
prepare
语句时数组中的所有占位符都正确:

 $how_many = count($usersRegisteFrOtherEvents);
 $placeholders = array_fill(0, $how_many, '%d');
 $format = implode(', ', $placeholders);

$format
的值是多少?$how_many=count($usersRegisteFrOtherEvents)$占位符=数组填充(0,$多少,'%d')$格式=内爆(“,”,$占位符)
$format
string或integer?echo
$query
在phpmyadmin work或notMy中运行查询。我的查询在where子句中针对单个条件工作,但在where子句中不针对多个条件工作