title: Only variables can be passed by reference error - How to fix
body: <p>I am trying to insert data into the database but I am recieving this error in my bind_param():</p>
  
  <pre><code>Fatal error: Only variables can be passed by reference in ... on line 48 
  </code></pre>
  
  <p>I have been searching on the net but I don't quite understand what this error means as out of al the inserts I have done this is first time I have recieved this error.</p>
  
  <p>What is the problem which is causing this error?</p>
  
  <p>Below is the insert code:</p>
  
  <pre><code> $answersql = "INSERT INTO Penalty_Marks (PenaltyAnswer, PenaltyMarks, QuestionId) 
      VALUES (?, ?, ?)";
  
  if (!$insertanswer = $mysqli-&gt;prepare($answersql)) {
      // Handle errors with prepare operation here
  }
  
     $c = count($_POST['incorrect']);
  
      for($i = 0;  $i &lt; $c; $i++ )
      {
  
  
  $insertanswer-&gt;bind_param('iii', $_POST['incorrect'][$i], $_POST['answerMarks'][$i], $_POST['numQuestion'][$i]);
  </code></pre>
  
  <p>Below is the form where it retrieves the details (this form below has been cut down for easier viewing):</p>
  
  <pre><code>&lt;form id="PenaltyMarks" action="insertpenaltymarks.php" method="post"&gt;
  
      &lt;table id='penaltytbl'&gt;
      &lt;?php
  
      foreach($ques_ans as $questionId =&gt; $inc_ans)
      {
          $q_row_span = count($inc_ans);
          $row_count = 0;
          $inc_ans = array_values($inc_ans);
  
      ?&gt;
  
      &lt;tr class="questiontd"&gt;
      &lt;td&gt;
      &lt;input type="hidden" name="numQuestion" value="&lt;?php echo$questionId?&gt;" /&gt;
      &lt;/td&gt;
  
      &lt;td&gt;
      &lt;input type="hidden" class="hiddenincorrect" name="incorrect[]" value="&lt;?php echo$inc_ans[$row_count];?&gt;"&gt;
      &lt;/td&gt;
  
      &lt;td&gt;
      &lt;input  name="answerMarks[]" type="text" data-type="qmark" value='0'  /&gt;
      &lt;/td&gt;
  
      &lt;/tr&gt;
          &lt;?php
              //remaining incorrect answers in separate row (if any) follows here
          if($row_count &lt; $q_row_span - 1) 
          {
              for($i=($row_count + 1); $i&lt;$q_row_span; $i++) { ?&gt;     
                  &lt;tr&gt;
                  &lt;td&gt;
                  &lt;input type="hidden" class="hiddenincorrect" name="incorrect[]" value="&lt;?php echo$inc_ans[$i];?&gt;"&gt;
                  &lt;/td&gt;
  
                  &lt;td class="answermarkstd"&gt;
                  &lt;input  name="answerMarks[]" type="text" data-type="qmark" value='0'  /&gt;            
                  &lt;/td&gt;
                  &lt;/tr&gt;
          &lt;?php
              }
          }
      }
  
      ?&gt;
      &lt;/table&gt;
  
      &lt;/form&gt;
  </code></pre>