What is the proper method the do 'this' while executing a
Lets say you want to generate a random unique number.
First you create a random number and when it is created you
want to check if
it is unique by checking it against the database.
If it isn't, loop again and try again.
If it is, then move to the next step of the code block.
What I can't figure out is how break out of the loop if the
Here is some of my code. How do I break out of the loop if
of the 'checking' query EQ 0?
What I use to generate a random number:
<cfloop index="i" from="1" to="4" step="1">
<cfset a = randrange(0,9)>
What I am going to use to check the number:
<cfquery name="checknumber" datasource="**">
SELECT * WHERE examid = #exid#
<cfif checknumber.recordcount EQ 0> or <cfif
checknumber.recordcount NEQ 0>