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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.