Jump to content

How should write this query


hno

Recommended Posts

that error means just what it says: you are listing x amount of columns to insert and y amount of values and those 2 numbers don't match.  Example that would produce that error:

 

insert into table (column1,column2,column3) values ('a','b')

 

uh oh, you have 3 columns listed but are only providing 2 values...

you are using a variable for a column name.  Does this mean your table has id, ad_id, user_id and then for instance 5 more columns and you are populating one of them depending on your script?  If that is what you are doing, your error is probably because you do not have your columns setup with a default value, so sql expects you to provide a value for all of them, not just one of them.  Either include the columns and a null/0/whatever in your query string or else in phpmyadmin ( or however you go directly to your database), set up your columns to have a default value.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.