Jump to content

Archived

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

chuddyuk

PLEASE HELP - insert error - "column count does not match value at line 1"

Recommended Posts

when i submit my data i get this error -

"column count does not match value at line 1"

i have tried everything and it still doesnt work someone please help me its really winding me up!

[code]$sql = "INSERT INTO appform
(id,
q1,
q1a,
q2,
q2a,
q2b,
q2c,
q3,
q3a,
q4,
q5,
q6,
q7,
q8,
q9,
q10,
q11,
q12,
q13,
q14,
q15,
q16,
q17,
q18,
q19,
q20,
q21,
q22,
q23,
q24,
q25,
q26,
q27,
q28,
q29,
q30,
q31,
q32,
q32a,
q33,
q34,
q35,
q36,
q37,
q38,
q39,
q40,
q41,
q42,
q43,
q44,
q45,
q46,
q47,
q48,
q49,
q50,
q51,
q52,
q53,
q54,
q55,
q56,
q57,
q58,
q59,
q60,
q61,
q62,
q63,
q64,
q65,
q66,
q67,
q68,
q69,
q70,
q71,
q72,
q73,
q74,
q75,
q76,
q77,
q78,
q79,
q80,
q81,
q82,
q83,
q84,
q85,
q86,
q87,
q88,
q89,
q90,
q91,
q92,
q93,
q94,
q95,
q96,
q97,
q98,
q99,
q100,
q101)
VALUES
('id',
'$q1',
'$q1a',
'$q2',
'$q2a',
'$q2b',
'$q2c',
'$q3',
'$q3a',
'$q4',
'$q5',
'$q6',
'$q7',
'$q8',
'$q9',
'$q10',
'$q11',
'$q12',
'$q13',
'$q14',
'$q15',
'$q16',
'$q17',
'$q18',
'$q19',
'$q20',
'$q21',
'$q22',
'$q23',
'$q24',
'$q25',
'$q26',
'$q27',
'$q28',
'$q29',
'$q30',
'$q31',
'$q32',
'$q32a',
'$q33',
'$q34',
'$q35',
'$q36',
'$q37',
'$q38',
'$q39',
'$q40',
'$q41',
'$q42',
'$q43',
'$q44',
'$q45',
'$q46',
'$q47',
'$q48',
'$q49',
'$q50',
'$q51',
'$q52',
'$q53',
'$q54',
'$q55',
'$q56',
'$q57',
'$q58',
'$q59',
'$q60',
'$q61',
'$q62',
'$q63',
'$q64',
'$q65',
'$q66',
'$q67',
'$q68',
'$q69',
'$q70',
'$q71',
'$q72',
'$q73',
'$q74',
'$q75',
'$q76',
'$q77',
'$q78',
'$q79',
'$q80',
'$q81',
'$q82',
'$q83',
'$q84',
'$q85',
'$q86',
'$q87',
'$q88',
'$q89',
'$q90',
'$q91',
'$q92',
'$q92',
'$q93',
'$q94',
'$q95',
'$q96',
'$q97',
'$q98',
'$q99',
'$q100',
'$q101')";
$query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error());
echo "<center>Application Sent<center>";[/code]

Share this post


Link to post
Share on other sites
hi

is id an auto_increment field? you can start by dropping that from both sides if so... as you are trying to insert a vairable it supposed to pick up from itself which i imagine doesn't work.

secondly - as much as i would love to verify the counts of the q's on both sides!!! lol!

cheers,
tdw

Share this post


Link to post
Share on other sites
im using

[code]srand((double)microtime()*1000000); 
$id1 =  rand(1000,9999);
srand((double)microtime()*1000000); 
$id2 =  rand(1000,9999);
$id = $id1 . $id2;
$id = md5($id);[/code]

to make the id.

Share this post


Link to post
Share on other sites
... okay well then in the VALUES part of the query you need to change

q100,
q101)
VALUES
('id',
'$q1',

to

q100,
q101)
VALUES
('$id',
'$q1',

to read the variable.

cheers,
tdw

Share this post


Link to post
Share on other sites
'$q92',
'$q92',

You have a duplicated entry. So the column counts don't match up.

Share this post


Link to post
Share on other sites
Mjlogan Yours a star, iv been staring at that for hours looking for duplicates or missing one. thank you so much mate!

Share this post


Link to post
Share on other sites
Yikes... If you're going to have something as ridiculous as that, it had better be dynamically generated.

Share this post


Link to post
Share on other sites

×

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.