We help IT Professionals succeed at work.
Get Started

coldfusion insert/update problem

erikTsomik
erikTsomik asked
on
806 Views
Last Modified: 2013-12-24
can somebody tell me what I am dong wrong here. I have to buttons insert and update and only update get executed
<cfif programAction eq "Insert Program">
       <cftry>
           <cfquery name="insertProgram" datasource="HotBanana_Manager">
       
        insert into trnAcademicPrograms (program,degree,major,fullname,programoption,fee,school_division,hidden,programNote,cohortname) values
('#form.program2#','#form.degree2#','#form.major2#','#form.fullname2#','#form.programoption2#',#form.fee1#,'#session.schoolcode#', '#form.hiddenfield#', '#form.programnote2#', '#form.cohortname2#')

        </cfquery>
   <cfcatch type="database">
   There was a dataabse error
   </cfcatch>
   </cftry>
   
<cfelse>

      <cftry>
   
        <cfquery name="updateProgram" datasource="HotBanana_Manager">
              update trnAcademicPrograms set program='#form.program2#', degree='#form.degree2#', major='#form.major2#', fullname='#form.fullname2#', programoption='#form.programoption2#', fee=#form.fee1#,
hidden=#form.hiddenfield#, programnote='#form.programnote2#', cohortname='#form.cohortname2#' where school_division='#session.schoolcode#' and id=#form.programlist#
       
        </cfquery>
     
   <cfcatch type="database">
   There was a dataabse error
   </cfcatch>
   </cftry>
</cfif>

 <input type="submit" name="programAction" id="updateProgram" value="Update Program"><br />
             <input type="submit" name="programAction" id="insertProgram" value="Insert Program"><br />
Comment
Watch Question
CERTIFIED EXPERT
Expert of the Year 2008
Top Expert 2008
Commented:
This problem has been solved!
Unlock 1 Answer and 12 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE