This is a multi-part message in MIME format.
------=_NextPart_000_00D4_01C032B7.F448F580
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
RE: random by day
Or a bit shorter, taking advantage of the ability to directly access a query
row.
<cfquery name="getrecords" datasource="MINE">
SELECT id,author,quote
FROM QUOTES
</cfquery>
<cfset x=randomize(timeformat(now(),"HHMMSS"))>
<cfset RandNum = #RandRange(1,getrecords.RecordCount)#>
<cfoutput>Random Record No = #getRecordsrecord.ID[randnum]#<BR>
Quote = #getrecords.Quote[randnum]#<BR>
Author = #getrecords.Author[author]# <BR>
</cfoutput>
DC
-----Original Message-----
From: Larry Juncker [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 09, 2000 20:59
To: CF-Talk
Subject: RE: random by day
Why not this?
<cfquery name="getrecords" datasource="MINE">
SELECT *
FROM QUOTES
</cfquery>
<cfset RandNum = #RandRange(1,getrecords.RecordCount)#>
<CFLOOP QUERY="getrecords">
<CFIF CurrentRow EQ #RandNum#>
<CFOUTPUT>
Random Record No = #getRecordsrecord.ID#<BR>
Quote = #getrecords.Quote#<BR>
Author = #getrecords.Author#
</cfoutput>
</cfif>
</cfloop>
Larry Juncker
Senior Cold Fusion Programmer
Heartland Communications Group, Inc.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 09, 2000 3:50 PM
To: CF-Talk
Subject: random by day
Last week there was a discussion about pulling a random quote from a
database. I would like to pull a record from a database once a week, lets
say every sunday. Kind of like the quote of the week. Whats the best way
to
do that?
KM
---------------------------------------------------
---------------------------------------------------
Get free personalized email at http://www.iname.com
--------------------------------------------------------------------------
--
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
--------------------------------------------------------------------------
----
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------=_NextPart_000_00D4_01C032B7.F448F580
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>RE: random by day</TITLE>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3018.900" name=3DGENERATOR></HEAD>
<BODY>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D353394212-10102000>Or a=20
bit shorter, taking advantage of the ability to directly access a query=20
row.</SPAN></FONT><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D353394212-10102000></SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D353394212-10102000></SPAN></FONT> </DIV>
<DIV><SPAN class=3D353394212-10102000>
<P><FONT color=3D#0000ff face=3DArial size=3D2><cfquery =
name=3D"getrecords"=20
datasource=3D"MINE"> <BR>SELECT <SPAN=20
class=3D353394212-10102000>id,author,quote</SPAN> <BR>FROM QUOTES=20
<BR></cfquery> </FONT></P>
<P><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D353394212-10102000><cfset=20
x=3Drandomize(timeformat(now(),"HHMMSS"))></SPAN></FONT></P>
<P><FONT color=3D#0000ff><FONT face=3DArial size=3D2><cfset RandNum =
=3D=20
#RandRange(1,getrecords.RecordCount)#> </FONT></FONT></P>
<P><FONT color=3D#0000ff><FONT face=3DArial size=3D2><SPAN=20
class=3D353394212-10102000><cfoutput></SPAN></FONT></FONT><FONT=20
color=3D#0000ff face=3DArial size=3D2>Random Record No =3D =
#getRecordsrecord.ID<SPAN=20
class=3D353394212-10102000>[randnum]</SPAN>#<BR> <BR> Quote =
=3D=20
#getrecords.Quote<SPAN class=3D353394212-10102000>[</SPAN><SPAN=20
class=3D353394212-10102000>randnum]</SPAN>#<BR> <BR> Author =
=3D=20
#getrecords.Author<SPAN class=3D353394212-10102000>[auth</SPAN><SPAN=20
class=3D353394212-10102000>or]</SPAN># <SPAN=20
class=3D353394212-10102000><BR></SPAN></FONT></P>
<P><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D353394212-10102000></SPAN><BR></cfoutput> </FONT></P>
<P><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D353394212-10102000>DC</SPAN></FONT></P>
<P><FONT color=3D#0000ff face=3DArial size=3D2><BR></FONT></SPAN><FONT=20
face=3DTahoma><FONT size=3D2>-----Original Message-----<BR><B>From:</B> =
Larry=20
Juncker [mailto:[EMAIL PROTECTED]]<BR><B>Sent:</B> Monday, =
October 09,=20
2000 20:59<BR><B>To:</B> CF-Talk<BR><B>Subject:</B> RE: random by=20
day<BR><BR></P></FONT></DIV>
<BLOCKQUOTE style=3D"MARGIN-RIGHT: 0px"></FONT>
<P><FONT size=3D2>Why not this?</FONT> </P>
<P><FONT size=3D2><cfquery name=3D"getrecords" =
datasource=3D"MINE"></FONT>=20
<BR><FONT size=3D2>SELECT *</FONT> <BR><FONT size=3D2>FROM =
QUOTES</FONT> <BR><FONT=20
size=3D2></cfquery></FONT> </P>
<P><FONT size=3D2><cfset RandNum =3D=20
#RandRange(1,getrecords.RecordCount)#></FONT> </P>
<P><FONT size=3D2><CFLOOP QUERY=3D"getrecords"></FONT>=20
<BR> <FONT size=3D2><CFIF =
CurrentRow EQ #RandNum#></FONT>=20
<BR> =20
<FONT=20
size=3D2><CFOUTPUT></FONT> =
<BR> =20
=20
<FONT size=3D2>Random =
Record No =3D=20
#getRecordsrecord.ID#<BR></FONT>=20
<BR> =20
=20
<FONT size=3D2>Quote =3D=20
#getrecords.Quote#<BR></FONT>=20
<BR> =20
=20
<FONT size=3D2>Author =3D=20
#getrecords.Author#</FONT> =
<BR> =20
<FONT=20
size=3D2></cfoutput></FONT> =
<BR> =20
<FONT size=3D2></cfif></FONT> <BR><FONT =
size=3D2></cfloop></FONT> </P>
<P><FONT size=3D2>Larry Juncker</FONT> <BR><FONT size=3D2>Senior Cold =
Fusion=20
Programmer</FONT> <BR><FONT size=3D2>Heartland Communications Group, =
Inc.</FONT>=20
</P><BR>
<P><FONT size=3D2>-----Original Message-----</FONT> <BR><FONT =
size=3D2>From:=20
[EMAIL PROTECTED] [<A=20
href=3D"mailto:[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]</A>]</FONT> =
<BR><FONT=20
size=3D2>Sent: Monday, October 09, 2000 3:50 PM</FONT> <BR><FONT =
size=3D2>To:=20
CF-Talk</FONT> <BR><FONT size=3D2>Subject: random by day</FONT> =
</P><BR><BR>
<P><FONT size=3D2>Last week there was a discussion about pulling a =
random quote=20
from a</FONT> <BR><FONT size=3D2>database. I would like to pull a =
record from a=20
database once a week, lets</FONT> <BR><FONT size=3D2>say every sunday. =
Kind of=20
like the quote of the week. Whats the best way to</FONT> =
<BR><FONT=20
size=3D2>do that?</FONT> </P>
<P><FONT size=3D2>KM</FONT> <BR><FONT=20
size=3D2>---------------------------------------------------</FONT> =
</P><BR>
<P><FONT =
size=3D2>---------------------------------------------------</FONT>=20
<BR><FONT size=3D2>Get free personalized email at <A =
href=3D"http://www.iname.com"=20
target=3D_blank>http://www.iname.com</A></FONT> <BR><FONT=20
=
size=3D2>----------------------------------------------------------------=
------------</FONT>=20
<BR><FONT size=3D2>--</FONT> <BR><FONT size=3D2>Archives: <A=20
href=3D"http://www.mail-archive.com/[email protected]/"=20
=
target=3D_blank>http://www.mail-archive.com/[email protected]/</A=
></FONT>=20
<BR><FONT size=3D2>To Unsubscribe visit</FONT> <BR><FONT size=3D2><A=20
=
href=3D"http://www.houseoffusion.com/index.cfm?sidebar=3Dlists&body=3D=
lists/cf_talk"=20
=
target=3D_blank>http://www.houseoffusion.com/index.cfm?sidebar=3Dlists&am=
p;body=3Dlists/cf_talk</A>=20
or</FONT> <BR><FONT size=3D2>send a message to =
[EMAIL PROTECTED]=20
with 'unsubscribe' in</FONT> <BR><FONT size=3D2>the body.</FONT> =
</P><BR>
<P><FONT=20
=
size=3D2>----------------------------------------------------------------=
--------------</FONT>=20
<BR><FONT size=3D2>Archives: <A=20
href=3D"http://www.mail-archive.com/[email protected]/"=20
=
target=3D_blank>http://www.mail-archive.com/[email protected]/</A=
></FONT>=20
<BR><FONT size=3D2>To Unsubscribe visit <A=20
=
href=3D"http://www.houseoffusion.com/index.cfm?sidebar=3Dlists&body=3D=
lists/cf_talk"=20
=
target=3D_blank>http://www.houseoffusion.com/index.cfm?sidebar=3Dlists&am=
p;body=3Dlists/cf_talk</A>=20
or send a message to [EMAIL PROTECTED] with =
'unsubscribe' in=20
the body.</FONT></P></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_00D4_01C032B7.F448F580--
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.