Answer the question
In order to leave comments, you need to log in
How to wrap mysqli_stmt_bind_param function?
The question is:
I want to wrap the mysqli_stmt_bind_param function into a database class method.
the function itself accepts references to variables, in an unlimited number, but how to implement this in the bind method
(pass an unlimited number of arguments to the method)
I tried to solve this way:
public function bind(){
$this->bind = mysqli_stmt_bind_param($this->prepare, join(', ',func_get_args()));
}
public function bind(){
$param = func_get_args();
$type = array_shift($param);
$refarg = array($this->prepare,$type);
foreach ($param as $key => $value):
$refarg[] =& $param[$key];
endforeach;
$this->bind = call_user_func_array("mysqli_stmt_bind_param", $refarg);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question