PHP and MySQLi - Cannot pass parameter 2 by reference in

后端 未结 3 1137
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 13:02

I am trying to make a function which will check update and insert some data but I am having an issue in the first step where the $stmt->bind_param is saying that is not p

相关标签:
3条回答
  • 2020-11-29 13:47

    Make 0 a variable or include it directly in your query.

    $zero = 0;
    $stmt->bind_param("ii", $zero, $victimiid);
    
    0 讨论(0)
  • 2020-11-29 13:50

    You cannot do this in mysqli:

    $stmt->bind_param("ii",0,$victimiid);
    

    The 0 needs to be a variable.

    Try this:

    $zero = 0;
    $stmt->bind_param("ii",$zero,$victimiid);
    
    0 讨论(0)
  • 2020-11-29 13:52

    Watch out! mysqli_stmt::bind_param accepts a reference to a variable, not a constant value. Therefore you have to create a variable to hold that 0 and then reference that variable instead.

    $i = 0;
    $stmt->bind_param("ii", $i, $victimiid);
    
    0 讨论(0)
提交回复
热议问题