开发者

Cannot pass parameter by reference in MySQLi [duplicate]

开发者 https://www.devze.com 2023-02-22 06:54 出处:网络
This question already has answers here: 开发者_Go百科 PHP error: "Cannot pass parameter 2 by reference"
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

精彩评论

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