PHP + MYSQL: Invalid parameter number: number of bound variables does not match...
Hello Everybody,
I am attempting to Insert some data into my mySQL table but it's not working; instead it throws the following error: Quote:
Code:
CREATE TABLE users ( PHP Code:
Does anybody know what the problem is, or can at least point me in the right direction? Thanks for reading, -Chris |
I would start by doing what the error complains about. You have 14 fields in your table but you are only binding 13 of them to values. Just because you have a field that is auto incremented, does not mean you can omit a value for it in your insert statement. A simple zero will suffice.
|
Hmm, I tried adding all the values, but I still got the same error. Then I found that I had accidentally used the wrong variable to bind the values, so just in case, I tried inserting constant data into the database, but it's still not working- I get the same error as before.
Any ideas? PHP Code:
|
Check your sql statement INSERT INTO users ...
What is between zipCode and relationship ? |
Thank you,
That was one of the problems. The other one that was causing an issue was the fact that I forgot to add a colon to my values, so there was no binding for the confirm parameter. Thanks again. -Chris |
Pesky syntax errors ;-)
|
I came across this and I do not like reopening very old posts however the statement made by smoker
Quote:
Like I said above I do not usually ressurect old posts however I found this individuals statement VERY INCORRECT and felt that I should post so if noobies come along in the future they do not take smoker's statement as fact when in fact it is incorrect. This type of misinformation leads to new coders becomming sloppy coders very quickly! Just trying to be helpful, thanks! |
All times are GMT -5. The time now is 03:56 AM. |