Ok this works great below, I get 12 random numbers and populate a txt doc with information that I get from the database by the random number GREAT, one thing, I dont want the random number to repeat itself ever so each 12 numbers ( that I am getting from the ID field in the database ) have to be unique.
Any Ideas?
<cfquery name="RandomMeal" datasource="Spin4G">
SELECT Sum(1) AS rnum
FROM Thes
</cfquery>
<cfset thisNumber = 2>
<cfloop index="RandomMeal.ID" from="1" to="12">
<cfset R1 = RandRange(1,RandomMeal.rnum)>
<cfoutput>#R1#</cfoutput>
<cfquery datasource="Spin4G" name="List">
SELECT *
FROM Thes
Where WheelID = #R1# and Type = 'Blond'
</cfquery>
<cfif thisNumber gt 2>
<cfelse>
<cffile action="write" output="&Name1=#List.Name#&ImageLg1=#List.ImageLg#&Image1=#List.Image#&Link1=#List.Link#" file="#expandpath("SpinWheelTwelve.txt")#">
</cfif>
<cffile action="append" addnewline="yes" output="&Name#thisNumber#=#List.Name#&ImageLg#thisNumber#=#List.ImageLg#&Image#thisNumber#=#List.Image#&Link#thisNumber#=#List.Link#" file="#expandpath("SpinWheelTwelve.txt")#">
<cfset thisNumber = thisNumber + 1>
</cfloop>