0
Good afternoon!
I’m encountering problems to perform the following insert:
function cadastro($usuario,$senha,$status){
$pdo = con();
$usuario = "Matheus";
$senha = "123";
$status = 3;
$inf = [
'usuario' => $usuario,
'senha' => $senha,
'status' => $status,
];
$sql = "SELECT id FROM usuarios WHERE usuario = :usuario";
$stmt= $pdo->prepare($sql);
$stmt->execute($inf);
Error message:
Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
Thanks in advance!
Thanks for the answer, actually my mistake was not having put the whole function, there is a part of the function that makes exactly this INSERT that you commented, but before doing this INSERT I need to do this SELECT only with the user name to know if there is already an equal user.
– Matheus Santos