I am trying to pass a string into my MySQLi prepared statement but it gives me the error:
Cannot pass parameter by reference in MySQLi
Here is the relevant code:
$kv = json_encode(array($key => $value));
$stmt->prepare("insert into rules (application_id, ruletype, rule_name, rule_info) values (?, ?, ?, ?);");
$stmt->bind_param('iiss', $application_id, 1, $config_name, $kv);
'1' cannot be passed by reference because it's not a variable but a literal. You need to create a variable with mentioned value and bind it instead because bind_param()
function expects variables passed by reference.
Check $config_name
argument. '1'
not pass as refernces
精彩评论