Solved

updating the database

Posted on 2000-05-02
2
131 Views
Last Modified: 2013-12-24
I am creating a page where I give users the abilty to enter a resume in the database and also the ability to come back and edit it. The problem I am having is that I am using an insert statement then an update statement. If I use only an insert then it will insert the record a number of times, once for everytime they fill out their resume. The update statement will work but only if I enter their id (parid) into the database first. How can i set it up so that when they fill out the form for their first time it will enter the id into the database, and then after that it will simply update the info...here is what I have now.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<cfoutput>#parid#</cfoutput>
<html>
<head>
      <title>Untitled</title>
</head>

<cfquery datasource="#ODBC_Datasource#" name="insert">
Insert into Resume(
                  ParId)
                  
            Values(
                  #parid#)
                  
                        
</cfquery>


<CFQUERY datasource="#ODBC_Datasource#" name="Update_Resume">
            Update resume
                  
            Set      
                Parid=#parid#,
                Resume1='#form.resume1#',
                  Resume2='#form.resume2#',
                  Resume3='#form.resume3#',
                  Resume4='#form.resume4#',
                  Resume5='#form.resume5#',
                  Resume6='#form.resume6#',
                  Resume7='#form.resume7#',
                  Resume8='#form.resume8#',
                  Resume9='#form.resume9#',
                  Resume10='#form.resume10#'
                  
            Where ParID = #ParID#
            
            </CFQUERY>
<body>

<CFLOCATION url="who.cfm">

</body>
</html>
0
Comment
Question by:the_kid
2 Comments
 

Accepted Solution

by:
bhakthan earned 10 total points
Comment Utility
Use session id as the parid. So you can use the same id for inserting and updating the table. Or create a cookie with parid and use the cookie for updating.
0
 

Author Comment

by:the_kid
Comment Utility
Thanks for your help...
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now