Problem with bindParam: "ORA-01745: invalid host / bind variable name"


I am trying to insert a user and his password into my Oracle database. When I insert a basic name and password, all right. But when I try to insert a user, with a password hasheada, I do not get an error, but it does not do anything to me either.

I attach the code:

require_once "../INCLUDES/conn.php";

$con = connection();
$user = 'usuario';
$pass = password_hash('K899XMu8ee4I', PASSWORD_DEFAULT);

$statement = $con->prepare("INSERT INTO usuarios (name, pass) VALUES (:user, 
$statement->bindParam(':user', $user);
$statement->bindParam(':pass', $pass);
$con = null;

I get the following error:

Array ( 
    [0] => HY000
    [1] => 1745
    [2] => OCIStmtExecute: ORA-01745: invalid host/bind variable name (ext\pdo_oci\oci_statement.c:159) 
asked by Pelayo 13.02.2018 в 11:08

1 answer


Apparently USER is a reserved word for Oracle.

The solution has been to change :user by :usuario .

answered by 13.02.2018 в 11:23