Hi,
I have a query like this:
$sql = "SELECT *
FROM tb_user US
WHERE US.username = :username
AND (US.password = :password
OR US.password_sis = :password
";
$command = $connection->createCommand($sql);
$command->bindParam(":username",$this->username,PDO::PARAM_STR);
$command->bindParam(":password",strtoupper(md5($this->password)),PDO::PARAM_STR);
$dataReader = $command->queryRow();
And I have this exception:
CDbCommand failed to execute the SQL statement: SQLSTATE[HY000] [1008] OCIStmtExecute: ORA-01008: not all variables bound.
To solve this, I have to modify the code in this way:
$sql = "SELECT *
FROM tb_user US
WHERE US.username = :username
AND (US.password = :password
OR US.password_sis = :password_sis
";
$command = $connection->createCommand($sql);
$command->bindParam(":username",$this->username,PDO::PARAM_STR);
$command->bindParam(":password",strtoupper(md5($this->password)),PDO::PARAM_STR);
$command->bindParam(":password_sis",strtoupper(md5($this->password)),PDO::PARAM_STR);
$dataReader = $command->queryRow();
And the query executes successfully.
The question: It’s not possible to repeat the same param more than one once in a query?