I have the following line of code which worked in PHP 5.1, but isn't working in PHP 5.3.
$input = array('ss','john','programmer');
call_user_func_array(array($mysqli_stmt, 'bind_param'), $input);
In PHP 5.3, I get the following warning message:
Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a reference, value given in /var/www/startmission/em/class/cls.data_access_object.php on line 785
I changed the code to the following and it worked:
$a = 'johnl';
$b = 'programmer';
$mysqli_stmt->bind_param('ss',$a,$b);
I found this in the php documentation:
Care must be taken when using mysqli_stmt_bind_param() in conjunction with call_user_func_array(). Note that mysqli_stmt_bind_param() requires parameters to be passed by reference, whereas call_user_func_array() can accept as a parameter a list of variables that can represent references or values.
So my question is, how do I replicate the functionality of the call_user_func_array + bind_params such that i can dynamically bind variables at run time?