1

I'm trying to insert a list of ids in a query as such:

    $base_query = $base_query . " 
LEFT 
JOIN {$wpdb->prefix}wpc_client_objects_assigns as o 
    ON o.object_id = f.id 
 WHERE f.cat_id = %d 
   AND o.assign_id IN (%s)";
    $base_query = $wpdb->prepare($base_query, $request['cat'], $customer_ids);

I can log the query:

SELECT * 
  FROM kh05R1_wpc_client_files as f 
  LEFT 
  JOIN kh05R1_wpc_client_objects_assigns as o 
    ON o.object_id = f.id 
 WHERE o.assign_id IN ('138,41,78');

This query only returns the first id.

How can I fix this query to allow an array of ids (or strings)?

Strawberry
  • 33,750
  • 13
  • 40
  • 57
AlxVallejo
  • 3,066
  • 6
  • 50
  • 74

0 Answers0