Jump to content


Photo

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


  • Please log in to reply
6 replies to this topic

#1 chuddyuk

chuddyuk
  • Members
  • PipPip
  • Member
  • 28 posts
  • LocationEngland

Posted 04 October 2006 - 11:49 AM

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!

$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>";


#2 thedarkwinter

thedarkwinter
  • Members
  • PipPipPip
  • Advanced Member
  • 191 posts
  • LocationLondon

Posted 04 October 2006 - 11:54 AM

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


Remember - if you don't figure it out yourself, you'll probably forget it tomorrow :)

#3 chuddyuk

chuddyuk
  • Members
  • PipPip
  • Member
  • 28 posts
  • LocationEngland

Posted 04 October 2006 - 12:01 PM

im using

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

to make the id.



#4 thedarkwinter

thedarkwinter
  • Members
  • PipPipPip
  • Advanced Member
  • 191 posts
  • LocationLondon

Posted 04 October 2006 - 01:06 PM

... 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
Remember - if you don't figure it out yourself, you'll probably forget it tomorrow :)

#5 mjlogan

mjlogan
  • Members
  • PipPipPip
  • Advanced Member
  • 122 posts

Posted 04 October 2006 - 01:10 PM

'$q92',
'$q92',

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

#6 chuddyuk

chuddyuk
  • Members
  • PipPip
  • Member
  • 28 posts
  • LocationEngland

Posted 04 October 2006 - 01:26 PM

Mjlogan Yours a star, iv been staring at that for hours looking for duplicates or missing one. thank you so much mate!

#7 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 04 October 2006 - 07:40 PM

Yikes... If you're going to have something as ridiculous as that, it had better be dynamically generated.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users