Click here to Skip to main content
15,849,406 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello everyone, my problem is when I add the sentence, this error appears
Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in C:\xampp\htdocs\app\sections\users\create. php:15 Stack trace: #0 C:\xampp\htdocs\app\sections\users\create.php(15): PDOStatement->execute() #1 {main} thrown in C:\xampp\htdocs\app\ sections\users\create.php on line 15

i need help please and thank you

What I have tried:

<?php include ("../../bd.php");


$sentencia=$conexion->prepare("INSERT INTO tbl_usuarios (id,usuario,password,correo)
VALUES (NULL,:usuarios,:password,:correo)");


Updated 28-Jul-23 6:31am
Richard MacCutchan 26-Jul-23 16:15pm    
At a guess one of your parameter values is missing. Unfortunately you do not check to make sure that all three are valid.
Richard Deeming 1-Aug-23 5:04am    
You are storing your users' passwords in plain text. Don't do that!
Secure Password Authentication Explained Simply[^]
Salted Password Hashing - Doing it Right[^]

PHP even has built-in functions to help you do the right thing:
PHP: password_hash[^]
PHP: password_verify[^]

1 solution

You misspelled one of your parameters:
$sentencia=$conexion->prepare("INSERT INTO tbl_usuarios (id,usuario,password,correo)
VALUES (NULL,:usuarios,:password,:correo)");


In the SQL statement, you called the parameter "usuarios" and in the bindParam function, you called it "usuario".
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900