Solved

updating the database

Posted on 2000-05-02
2
135 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
ID: 2769839
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
ID: 2792433
Thanks for your help...
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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