PDO bindParam() with prepared statement isn’t working

Using bindParam() the variable is bound as a reference.

A string can’t be passed by reference.

The following things can be passed by reference:

Variables, i.e. foo($a)

New statements, i.e. foo(new foobar())

References returned from functions

Try using bindValue()

$STH->bindValue(':id', '1', PDO::PARAM_STR);

Leave a Comment