hi
What is the correct way to do a function like:
public function check_offers_available($db, $skills_user) {
$arr_tags = array('16', '17', '36', '546');
$z = implode(', ', array_fill(0, count($arr_tags), '?'));
$str = implode('', array_fill(0, count($arr_tags),'s'));
$par = "'" . implode("','", $arr_tags) . "'";
$c_arr_tags = count($arr_tags);
$sql = $db -> prepare("
SELECT offer_id_offer
FROM offer_has_tags
WHERE tags_id_tags IN ($z)
GROUP BY offer_id_offer
HAVING COUNT(*) = ?
");
$sql -> bind_param("$str.'i'", $par, $c_arr_tags);
$sql -> execute();
$sql -> bind_result($id_offer);
return $id_offer;
}
At the moment i got:
Number of elements in type definition string doesn’t match number of bind variables