Jump to content

problem with php+mysqli


felito

Recommended Posts

hi

 

What is the correct way to do a function like:

public function check_($db, $skills) {
	$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_tag);

	$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("$srt.'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

 

 

Link to comment
https://forums.phpfreaks.com/topic/255799-problem-with-phpmysqli/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.