The examples in this article describe the use of PHP dynamic binding variables. Share to everyone for your reference. as follows:
Private Function Bindvars ($stmt, $params) {if ($params!= null) {$types = ';//initial sting with Types Forea CH ($params as $param) {//for each element, determine type and add if (Is_int ($param)) {$types. = ' I ';//in Teger} elseif (Is_float ($param)) {$types. = ' d '//double} elseif (Is_string ($param)) {$ty pes. = ' s ';
string} else {$types. = ' B ';
Blob and Unknown}} $bind _names[] = $types; The Param needed is the type string//eg: ' Issss ' for ($i =0; $i <count ($params); $i + +) {//go through incoming Params and added em to array $bind _name = ' bind '.
$i;
Give them an arbitrary name $ $bind _name = $params [$i];
Add the parameter to the variable variable $bind _names[] = &$ $bind _name; Now associate the variable as a element in a array}//call the function Bind_param with dynamic params CA Ll_user_func_array (Array ($stmt, ' Bind_param '), $binD_names); return $stmt; Return the bound statement
I hope this article will help you with your PHP programming.