Hello all,
If we have something like this, this will work, and we will not get any errors here:
I'm using something like this, and I'm able to insert data into the database.
Case A
PHP Code:
$stmt = $this->_dbh->prepare("INSERT INTO ourTable (ourColumn) VALUES (?)");
$stmt->bindParam(1, $someVo->getColumn(), PDO::PARAM_STR, 255);
If I do, however:
Case B
PHP Code:
$stmt = $this->_dbh->prepare("SELECT d.ourColumn FROM ourTable d WHERE d.ourColumn LIKE ?");
$stmt->bindParam(1, '%' . $someVo->getColumn() . '%', PDO::PARAM_STR, 255);
I do get:
Fatal error: Cannot pass parameter 2 by reference
- pointing to my bindParam line above.
I don't understand what this error means. Neither what pass something by reference really means... can I have some lights here?
I've read here and there that this may be related to the fact that we CANNOT pass values with bindParam but, that's what I do on the case A with success. 
Thanks in advance, again and again,
Márcio
Bookmarks