943,985 Members | Top Members by Rank

Ad:
  • ColdFusion Discussion Thread
  • Unsolved
  • Views: 2184
  • ColdFusion RSS
Jan 5th, 2006
0

Stopping entries into database

Expand Post »
I made an online registration form using ColdFusion MX and Access 2003. I want to be able to make it so when there are 20 entries into the database it will stop accepting signups. Does anyone know of any code that I could put on the page that checks for the number of entries and stops people from signing up if the limit has been met? Thanks!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Unverified User
Eiolon is offline Offline
6 posts
since Apr 2005
Mar 9th, 2006
0

Re: Stopping entries into database

Ok,


This is the code,

<cfquery name="number_entries" datasource="Your DNS">
SELECT “Primary Key Column�
FROM “Your table name�
WHERE “Primary Key Column� = 20
</cfquery>

<cfif number_entries.RecordCount NEQ 0>
<! ---this is the url the user will be sent to if you record count = 20--->
<! ---you have to create the “sorry.cfm� to tell the user that no more recorders can be added--->
<cflocation url="sorry.cfm" />

<cfelse>

<!--- if the count is < 20 than you INSERT the VALUES-->
<cfquery datasource="Your DNS">
INSERT INTO ( )
VALUES ( )
</cfquery>

</cfif>

It worked for me so it should work for you.

Take care,

Walyer

Walyer's Playpen
Reputation Points: 10
Solved Threads: 1
Light Poster
Walyer is offline Offline
26 posts
since Apr 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ColdFusion Forum Timeline: - Recently Unemployed CF Developer
Next Thread in ColdFusion Forum Timeline: Error Handling in CFSCRIPT





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC