Skip to content
Advertisement

Connection failed: SQLSTATE[HY093]: Invalid parameter number

Hello everyone, I’ve got a problem with my php code. I keep getting this error 0 1 2 3Connection failed: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens. As I understand it means that the number of parameters doesn’t match. I rewrited it many times and I’m pretty sure, that everything in this line $sqlQuery = "INSERT INTO users (email, password, firstname, lastname, day, month, year, sex, vkey) VALUES(?,?,?,?,?,?,?,?,?)"; is ok. Any ideas how to fix it?

Class code

Form code

And my mysql table https://imgur.com/a/39LLpbs

Advertisement

Answer

The execute only accepts array of parameters, but you send the parameters as string.

Change this code:

to

And this code:

to

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement