Skip navigation
ArronP
Currently Being Moderated

Insert then Query

Mar 6, 2007 3:10 PM

I have a small CFM application on our server. It worked well for several years. However, we just upgraded the coldfusion server and one item is not working.

I used to have folks fill out a form. The data was inserted into the database. I would query the database on the same page in which I did the insertion and all was fine....every record was available.

Now, however, when I query the database after the insertion, all records up to the lastest insertion are reflected. In other words, the page insertion data is not reflected in the query. However, the data is successfully inserted. (Inspection with other methods indicates the data was successfully inserted.)

Here is a scaled down code snippet.

<cfinsert datasource=#WList_DSN# tablename="Wait"
formFields="Fname,
Lname,
Snumber,
Course,
Password,
Phone,
Email">
<cfquery name="get_position" datasource=#WList_DSN# username=#WList_USERNAME# password=#WList_PASSWORD#>
SELECT ID, Fname, Lname, Snumber, Phone, Email FROM Wait
WHERE Course = '#form.Course#'
ORDER by ID
</cfquery>
<html>
<head>
<title>Test Page</title>
<body>
<cfoutput query="get_data">
#FNAME# #LNANE#<br>
</cfoutput>
</body>
</html>

#FNAME# and #LNAME# in the output show each record in the database except for the one just inserted. Is there a way to remedy this? I want to conduct the query on the same page as the insertion, if at all possible.

Any help would be greatly appreciated.

Thanks...
 
Replies
  • Currently Being Moderated
    Mar 7, 2007 8:32 AM   in reply to ArronP
    The output of query "get_data" is probably the query BEFORE the insert. The one you show running after the insert is "get_position", therefore:

    <cfoutput query="get_position">
    #FNAME# #LNAME#<br>
    </cfoutput>

    - Mike
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 8, 2007 7:19 AM   in reply to ArronP
    You should find out why it's suddenly taking 5 seconds to insert a record. Maybe you are no longer using the most appropriate driver.
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 9, 2007 10:04 AM   in reply to ArronP
    You might try changing from cfinsert to an actual query with an insert statement (Dan, who posted above, had suggested that and it "smoothed" alot of my forms right out).

    - Mike
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points