title: Why I am getting Cannot pass parameter 2 by reference error when I am using bindParam with a constant value?
body: <p>I'm using this code and I'm beyond frustration:</p>
  
  <pre><code>try {
      $dbh = new PDO('mysql:dbname=' . DB . ';host=' . HOST, USER, PASS);
      $dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      $dbh-&gt;setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
  }
  catch(PDOException $e)
  {
      ...
  }
  $stmt = $dbh-&gt;prepare('INSERT INTO table(v1, v2, ...) VALUES(:v1, :v2, ...)');
  $stmt-&gt;bindParam(':v1', PDO::PARAM_NULL); // --&gt; Here's the problem
  </code></pre>
  
  <p><code>PDO::PARAM_NULL, null, '',</code> all of them fail and throw this error:</p>
  
  <blockquote>
    <p><strong>Fatal error</strong>: Cannot pass parameter 2 by reference in /opt/...</p>
  </blockquote>