开发者

Cannot pass parameter by reference in MySQLi [duplicate]

This question already has answers here: 开发者_Go百科 PHP error: "Cannot pass parameter 2 by reference" (2 answers) Closed 1 year ago.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜