I am trying to input an array into my query. I am using Wordpress.
For security purposes, I need to use %s.
If I don't use %s, and put the $results directly inside the query, it works.
But if I use %s, it doesn't work.
What am I doing wrong?
<?php
/*$sym_result is an array*/
$result = implode("','",$sym_result);
$results = "'".$result."'";
$sql = $wpdb->get_results( $wpdb->prepare("
SELECT DISTINCT fruit FROM dis WHERE fruit IN (%s)
",$results));
print_r($sql);/*echo array()*/
?>