another Error executing database query

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default another Error executing database query

    Just when I thought I had all my forms finely tuned, I get the error below,
    which has me stumped (using DrmWeaver 2004, CF7, mysql):

    Error Executing Database Query.
    General error: Column count doesn't match value count at row 1

    The error occurred in C:\Inetpub\wwwroot\haf_cf\forms\businesses.cfm: line 81

    79 : <cfelse>
    80 : NULL
    81 : </cfif>
    82 : )
    83 : </cfquery>

    SQL INSERT INTO contacts (mem_type, firstname, lastname, company, address,
    address2, city, ste, zip, phone, fax, email, website, biz_type) VALUES ( 'CPM'
    , 'Osborne' , 'Sybex' , '2121 Chapp St' , NULL , 'Baltimore' , 'MD' , '10489' ,
    '555-555-4469' , '718-998-9988' , 'bill@asdx.com' , 'www.xyz.com' , 'Home
    Builder' )
    DATASOURCE haf

    This is the form code:

    <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
    <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">
    <cfquery datasource="fah">
    INSERT INTO business_apps (mem_type, firstname, lastname, company, address,
    address2, city, ste, zip, phone, fax, email, website, biz_type) VALUES (
    <cfif IsDefined("FORM.mem_type") AND #FORM.mem_type# NEQ "">
    '#FORM.mem_type#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.lastname") AND #FORM.lastname# NEQ "">
    '#FORM.lastname#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.company") AND #FORM.company# NEQ "">
    '#FORM.company#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.address") AND #FORM.address# NEQ "">
    '#FORM.address#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.address2") AND #FORM.address2# NEQ "">
    '#FORM.address2#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.city") AND #FORM.city# NEQ "">
    '#FORM.city#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.ste") AND #FORM.ste# NEQ "">
    '#FORM.ste#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.zip") AND #FORM.zip# NEQ "">
    '#FORM.zip#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.phone") AND #FORM.phone# NEQ "">
    '#FORM.phone#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.fax") AND #FORM.fax# NEQ "">
    '#FORM.fax#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.email") AND #FORM.email# NEQ "">
    '#FORM.email#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.website") AND #FORM.website# NEQ "">
    '#FORM.website#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.biz_type") AND #FORM.biz_type# NEQ "">
    '#FORM.biz_type#'
    <cfelse>
    NULL
    </cfif>
    )
    </cfquery>
    <cflocation url="../confirmation/confirm_business_mem.cfm">
    </cfif>

    I can't see anything wrong, but CF says that there is. I'm still going
    throught the learning curve. Thanks in advance for the help.

    blu_sky Guest

  2. Similar Questions and Discussions

    1. Error Executing Database Query
      I have a website, which is visited by 18.000 unique users a day, who view almost 900.000 pages As you can see, one user views a lot of pages....
    2. Error Executing Database Query.
      The error occurred in C:\CFusionMX7\wwwroot\CFIDE\gettingstarted\tutorial\index.cfm: line 2 2 : <cfquery name="atrwork"...
    3. error executing database query on login
      I've noticed we started getting this message when you try to Login to the website. We have recently just installed the CF standard edition 7.0 We...
    4. Error Executing Database Query.Communication link
      Pretty much everyday when I get up now all my coldfusion sites that use MySQL just take forever to load. In fact they never load or even time out,...
    5. Error Executing Access Database Query
      The query works in 5, chokes in MX7 Error Message: Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'. ...
  3. #2

    Default Re: another Error executing database query

    You're specifying 14 DB fields but you're only supplying 13 form fields. You forgot
    form.firstname, I believe.
    OldCFer Guest

  4. #3

    Default Re: another Error executing database query

    Dang!! You're right! I forgot the firstname field. I learn something new everytime I visit this forum. Guess I'll hang aroung here more often. Thanks again OldCFer!
    blu_sky Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139