Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2006
    Posts
    168
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Column count doesn't match value count at row 1

    Hi All

    I am getting the following error when I run my query.
    Column count doesn't match value count at row 1
    I have looked up this error and have checked and I appear to have the right number and names in my query. In the DB table I have 34 columns, and that is what I have in the query.

    The last 4 in the query are for the names of the images being uploaded, but am not sure how this all works, so I don't know if I need them, but have them there until I know for sure. Comment, Purchase and Remarks are not used in this form, but I have added them so everything is being shown in the query.

    Here is the query itself.


    Code:
    mysql_query ("Insert into `workorder`(ID,Work, Sched, Name, Site, Serial, Hours,
    	Starts, Issue, Severity, Resolution, Assistance, NumberA, PartsA, NumberB,
    	PartsB, NumberC, PartsC, NumberD, PartsD, NumberE, PartsE, NumberF,	PartsF,
    	NumberG, PartsG, Safety, Comment , Purchase , Remarks , Upload1, Upload2, Upload3, Upload4) VALUES
    	('', '$Work', '$Sched', '$Name', '$Site', '$Serial', '$Hours', '$Starts',
    	'$Issue', '$Severity', '$Resolution', '$Assistance', '$NumberA', '$PartsA',
    	'$NumberB', '$PartsB', '$NumberC', '$PartsC', '$NumberD', '$PartsD',
    	'$NumberE', '$PartsE', '$NumberF', '$PartsF', '$NumberG', '$PartsG',
    	'$Safety', '$Comment', '$Purchase', '$Remarks', '$Upload1', '$Upload2,' '$Upload3', '$Upload4')")
    	or die(mysql_error());

  • #2
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    Is it possible that some of the data you're putting into your query is corrupting the query? If your php variables have apostrophese in them, you'll run into trouble. Try echoing the query and analyzing it.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •