felito Posted January 26, 2012 Share Posted January 26, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/255799-problem-with-phpmysqli/ Share on other sites More sharing options...
felito Posted January 26, 2012 Author Share Posted January 26, 2012 should be $str and count($arr_tags);. Anyway, the problem is not that. Quote Link to comment https://forums.phpfreaks.com/topic/255799-problem-with-phpmysqli/#findComment-1311290 Share on other sites More sharing options...
requinix Posted January 26, 2012 Share Posted January 26, 2012 bind_param("$srt.'i'", $par, $c_arr_tags) That first argument is a bit messed up. If $str was empty then you'd be passing literally .'i' Quote Link to comment https://forums.phpfreaks.com/topic/255799-problem-with-phpmysqli/#findComment-1311292 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.