 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 23rd, 2004, 03:57 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Trying to establish an ID variable
Hello,
I'm trying to write the code for a website that I want to upload to a paid server for my new talent agency. I need to have a variable running on the server that sets my Talent ID# and keeps counting it just like autonumber in Microsoft Access. Do I have to cfset the variable or how can I do this so the variable doesn't reset to 0 everytime the page expires?
Respectfully submitted,
Larry V. Reitz, Jr.
|
|

January 23rd, 2004, 05:24 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
You may want to take a look at the following two articles. They describe a Hit Counter scenario, implemented in ASP. There are no Cold Fusion versions of these articles available, but these articles may give you enough ideas to implement a similar solution in CF.
http://Imar.Spaanjaars.Com/QuickDocID.aspx?QUICKDOC=227
http://Imar.Spaanjaars.Com/QuickDocID.aspx?QUICKDOC=238
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

January 24th, 2004, 12:59 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
*** The problem is that I am a student and I have only had one class in Cold Fusion. I am taking 8 week classes which is not enough time to fully learn all this code. ***
Respectfully submitted,
Larry V. Reitz, Jr.
|
|

January 25th, 2004, 07:31 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Well, I never said you should learn all that code; I said the articles could give you some ideas how to implement this in Cold Fusion.
Basically, the idea *is* the same: store a global number somewhere in memory and in a text file or database. Each time the number gets increased, you should also update the number in the file or database.
Alternatively (and more safe in your situation), have the database hand out an AutoNumber. For each new ID you need, insert a record in a specific table. Let the database assign a new ID for the record and use that ID as your ID. If you search Google, you'll find numerous examples of Cold Fusion code that uses a database.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |