Skip to main content
Known Participant
March 19, 2013
Question

Web host updated now I have problems

  • March 19, 2013
  • 2 replies
  • 1282 views

My website host updated from CF5 to CF9 and from I think MySQL 4 to 5 and now when I run my job application form I get this error while trying to execute it. anyone know how to fix this?

Error Executing Database Query.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'leave, supervisor, description) VALUES('ddMar-19-2013', '', '', '', '', '', '' at line 1
    This topic has been closed for replies.

    2 replies

    Participating Frequently
    March 19, 2013

    It would help to see the code in question that is erroring

    Guy DowdAuthor
    Known Participant
    March 19, 2013

    <cfoutput><cfset jobappid = '#appfirstname##form.applastname##DateFormat(Now(), "mmm-dd-yyyy")#'>
    #jobappid#<br>

    <cfset appdate= '#DateFormat(Now(), "yyyy-mmm-dd")#'>
    </cfoutput>

    <cfquery username='#username#' password='#password#'  datasource='#datasource#'>
    INSERT INTO jobapp(jobappid, appdate, applastname, appfirstname, appmiddlename, appphone, appstreet, appcity, appstate, appzip, fulltime, eighteen, appposition, previous, previousdate, available, experiences, crime, hsaddres, hssubjects, hsyears, hsgrad, hsdiploma, collegeaddres, collegesubjects, collegeyears, collegegrad, collegediploma, techaddres, techsubjects, techyears, techgrad , techdiploma, q1, q2, q3)
    VALUES('#jobappid#', '#appdate#', '#form.applastname#', '#form.appfirstname#', '#form.appmiddlename#', '#form.appphone#', '#form.appstreet#', '#form.appcity#', '#form.appstate#', '#form.appzip#', '#form.fulltime#', '#form.eighteen#', '#form.appposition#', '#form.previous#', '#form.previousdate#', '#form.available#', '#form.experiences#', '#form.crime#', '#form.hsaddres#', '#form.hssubjects#', '#form.hsyears#', '#form.hsgrad#', '#form.hsdiploma#', '#form.collegeaddres#', '#form.collegesubjects#', '#form.collegeyears#', '#form.collegegrad#', '#form.collegediploma#', '#form.techaddres#', '#form.techsubjects#', '#form.techyears#', '#form.techgrad #', '#form.techdiploma#', '#form.q1#', '#form.q2#', '#form.q3#')
    </CFQUERY>


    <cfquery username='#username#' password='#password#'  datasource='#datasource#'>
    INSERT INTO jobappemp(jobappid, company, busphone, empfromdate, emptodate, startwage, endwage, leave11, supervisor11, description11)
    VALUES('#jobappid#', '#form.company1#', '#form.busphone1#', '#form.empfromdate1#', '#form.emptodate1#', '#form.startwage1#', '#form.endwage1#', '#form.leave1#', '#form.supervisor1#', '#form.description1#')
    </CFQUERY>
    <cfif not #form.company2# is "">
    <cfquery username='#username#' password='#password#'  datasource='#datasource#'>
    INSERT INTO jobappemp(jobappid, company, busphone, empfromdate, emptodate, startwage, endwage, leave11, supervisor11, description11)
    VALUES('#jobappid#', '#form.company2#', '#form.busphone2#', '#form.empfromdate2#', '#form.emptodate2#', '#form.startwage2#', '#form.endwage2#', '#form.leave2#', '#form.supervisor2#', '#form.description2#')
    </CFQUERY>
    </cfif>
    <cfif not #form.company3# is "">
    <cfquery username='#username#' password='#password#'  datasource='#datasource#'>
    INSERT INTO jobappemp(jobappid, company, busphone, empfromdate, emptodate, startwage, endwage, leave11, supervisor11, description11)
    VALUES('#jobappid#', '#form.company3#', '#form.busphone3#', '#form.empfromdate3#', '#form.emptodate3#', '#form.startwage3#', '#form.endwage3#', '#form.leave3#', '#form.supervisor3#', '#form.description3#')
    </CFQUERY>
    </cfif>
    <cfif not #form.company4# is "">
    <cfquery username='#username#' password='#password#'  datasource='#datasource#'>
    INSERT INTO jobappemp(jobappid, company, busphone, empfromdate, emptodate, startwage, endwage, leave11, supervisor11, description11)
    VALUES('#jobappid#', '#form.company4#', '#form.busphone4#', '#form.empfromdate4#', '#form.emptodate4#', '#form.startwage4#', '#form.endwage4#', '#form.leave4#', '#form.supervisor4#', '#form.description4#')
    </CFQUERY>
    </cfif>
    <cfif not #form.company5# is "">
    <cfquery username='#username#' password='#password#'  datasource='#datasource#'>
    INSERT INTO jobappemp(jobappid, company, busphone, empfromdate, emptodate, startwage, endwage, leave11, supervisor11, description11)
    VALUES('#jobappid#', '#form.company5#', '#form.busphone5#', '#form.empfromdate5#', '#form.emptodate5#', '#form.startwage5#', '#form.endwage5#', '#form.leave5#', '#form.supervisor5#', '#form.description5#')
    </CFQUERY>
    </cfif>


    <cfquery username='#username#' password='#password#'  datasource='#datasource#'>
    INSERT INTO jobappref(jobappid, ref, refaddress, refphone)
    VALUES('#jobappid#', '#form.ref1#', '#form.refaddress1#', '#form.refphone1#')
    </CFQUERY>
    <cfquery username='#username#' password='#password#'  datasource='#datasource#'>
    INSERT INTO jobappref(jobappid, ref, refaddress, refphone)
    VALUES('#jobappid#', '#form.ref2#', '#form.refaddress2#', '#form.refphone2#')
    </CFQUERY>
    <cfquery username='#username#' password='#password#'  datasource='#datasource#'>
    INSERT INTO jobappref(jobappid, ref, refaddress, refphone)
    VALUES('#jobappid#', '#form.ref3#', '#form.refaddress3#', '#form.refphone3#')
    </CFQUERY>

    <cfmail to="doug@------.com"  from="jobApp@-------.com" subject="-----.com Job Application" type="HTML">
        <font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="-1"><strong> #appfirstname# #applastname# </strong> has applied for a position:<br>
         <br>
         <b>Date Applied: </b>#appdate#<br>
         Go to the admin section to review this application.
        
         </cfmail>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <link rel="stylesheet" href="style.css">
    <title>Imperial Industries Incorporated Job Application Submitted</title>
    </head>

    <body>
    <div align="center"><img src="images/Imperial_logo.gif" alt="" width="135" height="89" border="0"><p><br><br><br>
    <h2>Your Application has been Processed Completely.</h2><br><br>
    <form>
    <input style="background-color: 069;
    border-color: ccc;
    font-family : verdana, Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-size: 10px;
    color: #fff;" type=button value="Close This Window" onClick="javascript:window.close();">
    </form></div>

    </html>
    </body>

    
    Participating Frequently
    March 20, 2013

    At a guess, in the process of upgrading MySQL, a table definition has maybe changed.  Check things like column types and maxlengths for every column you're inserting to.

    You should also use cfqueryparam for all your queries.  Firstly to prevent possible SQL injection.  Secondly it can improve query performance (although I doubt it makes any difference for an insert), and also allows you to specify CFSQLType (corresponding to your DB column types) and MaxLength attributes.  Which might help you identify any problems in your data.

    Guy DowdAuthor
    Known Participant
    March 19, 2013

    I also ran my Cold fusion code through CF10 debugger and it came back with no errors