MySQLI binding params using call_user_func_array

后端 未结 7 2310
别跟我提以往
别跟我提以往 2020-11-30 09:01

Please see below my code. I am attempting to bind an array of paramenters to my prepared statement. I\'ve been looking around on the web and can see I have to use call_user_

7条回答
  •  Happy的楠姐
    2020-11-30 09:34

    If you get an error, you should try this:

    call_user_func_array(array($stmt, 'bind_param'), refValues($params));
    
    function refValues($arr){
        if (strnatcmp(phpversion(),'5.3') >= 0) {
            $refs = array();
            foreach($arr as $key => $value)
                $refs[$key] = &$arr[$key];
            return $refs;
        }
        return $arr;
    }
    

提交回复
热议问题