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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With