epseix1 Posted April 24, 2013 Share Posted April 24, 2013 The following code: $stmt->bind_param('s', $strId);How can I define EVERYTHING within the brackets as a single function as opposed to 2 separate variables? Can't seem to get syntax quite right... ... Is there a better method for storing all prepared statement variables, or all stmt code, in a separate "include" file using nested functions? All advice greatly appreciated? Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted April 24, 2013 Solution Share Posted April 24, 2013 bind_param() needs a variable reference for the second argument. It's not as simple as just using an array. Example: $arr = array(''); $arr[0] .= 's'; $arr[] =& $strId; $arr[0] .= 'i'; $arr[] =& $intFoo; $arr[0] .= 's'; $arr[] =& $strBar; call_user_func_array(array($stmt, 'bind_param'), $arr); // the magic happens here call_user_func_array Quote Link to comment 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.