Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error: Cannot pass parameter 1 by reference

Tags:

php

mysqli

I have this line:

$stmt->bind_result('d', $keyarray['payment_gross']);

and I get this error:

Fatal error: Cannot pass parameter 1 by reference in /home/star1231/public_html/pdt.php on line 35

What is the problem here?

like image 634
Kaki Baleven Avatar asked Jun 08 '15 19:06

Kaki Baleven


2 Answers

Not much I can tell about your code, but if parameter 1 is passed by reference in function definition then you need to do this.

$char = 'd';
$stmt->bind_result($char, $keyarray['payment_gross']);

Only variables can be passed by reference since you are passing the address of the variable and not an actual value. Let me know if it solves it

like image 110
qwerty_igor Avatar answered Sep 18 '22 05:09

qwerty_igor


You should use parameter type ONLY when you bind_param

$stmt->bind_param('d',$some_double_var);

but

$stmt->bind_result($answer_variable);
like image 29
fewrandom Avatar answered Sep 18 '22 05:09

fewrandom