View Single Post
  #5 (permalink)  
Old 09-02-2008, 06:54 PM
orjan's Avatar   
orjan orjan is offline
Programming Expert
 
Join Date: Sep 2007
Location: Sunne, Värmland, Sweden
Age: 33
Posts: 359
Last Blog:
Procedural Programming...
Credits: 42
Rep Power: 9
orjan has a spectacular aura aboutorjan has a spectacular aura aboutorjan has a spectacular aura about
Default Re: Column count doesn't match value count at row 1

I counted your named columns and got those to 23, but then your values, I were counting to 24, so there are one value too much there...
and, you shall not have parenthesis around each value, as John mentions above.

and as you're entering all columns if i'm right, you don't have to specify them at all

table with three columns can be inserted like this:

Code:
insert into mytable values (1,2,3);
if you want to enter more than one row at a time, you can write

Code:
insert into mytable values (1,2,3), (4,5,6), (7,8,9);
for inserting three rows at once.

btw, your code seems a bit unsecure as you drop your $_POST values directly into the database, as there is easily sql injections possible there.
I know that someone here (John?) made an excellent tutorial on sql injections.
Reply With Quote

Sponsored Links