Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

unique id when form is submitted

Explorer ,
Jul 23, 2008 Jul 23, 2008
I have a form that submits data to an access 2007 database. I am using formfields: Is there a way to create a unique id that gets entered into the database and display it as an registration/confirmation number on the action page? _ THANK YOU

<cfinsert datasource="design2008" tablename="2008RDCRegistratation"
formfields="fullname, Email, County, Title, Phone, Address1, Address2, Payment, CitySTZip, Allergies, Vegetarian,">
TOPICS
Getting started
687
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 23, 2008 Jul 23, 2008
You can use the CreateUUID function, do a query to make sure it's not already there, and then use it.

Or you can set up an autoincrement numeric field in access, change your cfinsert to a cfquery, and then select it after you insert the record.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 24, 2008 Jul 24, 2008
I do have an autoincrement field in the access database. I do not understand how to insert a record after changing the cfinsert to a query. Do you know a good reference or tutorial?

Thank you
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 24, 2008 Jul 24, 2008
I've heard good things about the book, Teach Yourself SQL in 10 Minutes by Ben Forta.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 24, 2008 Jul 24, 2008
Thanks - I will check out the book. I do have some understanding of sql - I just don't quite get the Coldfusion part of where things go and I have had a hard time finding examples for a beginner. I don't just want the code. I want to why it works. -- Thank you

jim
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 24, 2008 Jul 24, 2008
I tried adding a query to retrieve the date that a person registers on. I set the default value in access to Now() so it adds the date when a user submits a registration. I then added a query to retrieve the date. On the action page it retrieves the date but it returns ALL of the dates in the table - see query and output below. - thank you

<cfquery name="register" datasource="design2008">
SELECT RegisterDate FROM 2008RDCRegistratation
</cfquery>

<cfoutput query="register">Your registration number is #RegisterDate#</cfoutput>


OUTPUT:

Your registration number is Your registration number is Your registration number is Your registration number is 2008-07-24 10:20:03.0Your registration number is 2008-07-24 10:21:28.0Your registration number is 2008-07-24 10:22:04.0Your registration number is Your registration number is

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 24, 2008 Jul 24, 2008
Here is a hint.

<cfquery>
any sql you have permission to run goes here
</cfquery>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 24, 2008 Jul 24, 2008
You'll know why after you get that book and do all the tutorials.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 24, 2008 Jul 24, 2008
You don't have any criteria in your sql statement, so its going to return all RegisterDates. If you need some tutorials, just google cf beginner tutorials or check out this thread. Also, that book will come in very handy.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 24, 2008 Jul 24, 2008
LATEST
I added more to the query and was able to return the id field instead of the date field to use for the registration number. Is that okay to do? I learned a lot here.

Thank you both for your time.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources