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 5 of 5
  1. #1
    New Coder
    Join Date
    May 2007
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Query Error Help

    Hello:

    I'm trying to run a query and I'm receiving the following message:
    Column count doesn't match value count at row 1.

    I printed my table structure and cross-referenced to my insert statement and everything seems to be in order. I also printed a detail error message showing me the data for each field. I cross-referenced the data with the table and everything seems correct. I don't know what I'm missing.

    Can someone help me out?

    This is my query statement:
    Code:
    $query4 = "REPLACE INTO initial_plan (client_id, caseno, legal_status, emergency_no, ed_voc_status, ed_voc_stat_other, special_services, strength_assessment, reason_for_admin, 
                       meds1, meds2, meds3, meds4, meds5, dosage1, dosage2, dosage3, dosage4, dosage5, last_dental, medical_history, current_med_needs, 
                       special_behavior_concerns1, special_behavior_concerns2, special_behavior_concerns3, special_behavior_concerns4, special_behavior_concerns5, 
                       isp_deadline, treatment_need1, treatment_goal1, treatment_need2, treatment_goal2, treatment_need3, treatment_goal3, treatment_need4, treatment_goal4, treatment_need5, treatment_goal5, treatment_need6, treatment_goal6,
                       recommend_assessment, fund_agency, level_of_care, fund_rate) 
              
    
    VALUES ('$_POST[client_id]', '$_POST[caseno]', '$_POST[legal_status]', '$_POST[emergency_no]', '$_POST[ed_voc_status]', '$_POST[ed_voc_stat_other]', 
                     '$_POST[special_services]', '$_POST[strength_assessment]', '$_POST[reason_for_admin]', '$_POST[meds1]', '$_POST[meds2]', '$_POST[meds3]', '$_POST[meds4]', 
                     '$_POST[meds5]', '$_POST[dosage1]', '$_POST[dosage2]', '$_POST[dosage3]', '$_POST[dosage4]', 
                     '$_POST[dosage5]', '$_POST[last_dental]', '$_POST[medical_history]', '$_POST[current_med_needs]', '$_POST[special_behavior_concerns1]', '$_POST[special_behavior_concerns2]', 
                     '$_POST[special_behavior_concerns3]', '$_POST[special_behavior_concerns4]', '$_POST[special_behavior_concerns5]', '$_POST[isp_deadline]', '$_POST[treatment_need1]', 
                     '$_POST[treatment_goal1]', '$_POST[treatment_need2]', '$_POST[treatment_goal2]', '$_POST[treatment_need3]' 
                     '$_POST[treatment_goal3]', '$_POST[treatment_need4]', '$_POST[treatment_goal4]', '$_POST[treatment_need5]', '$_POST[treatment_goal5]', '$_POST[treatment_need6]', '$_POST[treatment_goal6]', '$_POST[recommend_assessment]', 
                     '$_POST[fund_agency]', '$_POST[level_of_care]', '$_POST[fund_rate]')";
    Thanks for the help.

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,026
    Thanks
    2
    Thanked 314 Times in 306 Posts
    Unless there is some other mis-match, you are missing a coma at the end of the following value -
    Code:
    '$_POST[treatment_need3]'  <----- , missing here
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    New Coder
    Join Date
    May 2007
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    Thank you so much. I thought it was going to be something as simple as a missing comma. The comma was definately the problem.

    Is there a text editor for PHP which highlights the errors?

    Thanks again for the help.

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,026
    Thanks
    2
    Thanked 314 Times in 306 Posts
    Highlighting editors are available, but this is limited to quoted strings, and matching up language elements, {}, if/else and such. For finding something like a missing coma from a list of data requires old fashion proof reading. I went thought the list, putting each item on its own line (I was going to see if there were in fact a matching number of columns called out and values listed.) When I got to a line that did not have the coma after the data, I knew I had found a problem.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #5
    New Coder
    Join Date
    May 2007
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the info.


  •  

    Posting Permissions

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