CFQUERY of non-swequential primary key ids

2006-08-23 Thread coldfusion . developer
All, I'm doing a query and randomly displaying images from within each record but records have been removed so I don't have sequential id values. PROBLEM: When I run this code sometime I get images, sometimes I get nothing. Should I be running a different random'izer? 8-) Any ideas? CODE:

RE: CFQUERY of non-swequential primary key ids

2006-08-23 Thread Ben Nadel
#lgthbimg#/cfoutput width=262 height=231 border=0 ... Ben Nadel www.bennadel.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 23, 2006 12:14 PM To: CF-Talk Subject: CFQUERY of non-swequential primary key ids All, I'm

RE: CFQUERY of non-swequential primary key ids

2006-08-23 Thread Everett, Al \(NIH/NIGMS\) [C]
/udf.cfm?id=524 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 23, 2006 12:14 PM To: CF-Talk Subject: CFQUERY of non-swequential primary key ids All, I'm doing a query and randomly displaying images from within each record but records have been

Re: CFQUERY of non-swequential primary key ids

2006-08-23 Thread Greg Morphis
You could query the table and get a list of the available IDs. Generate a random number between 1 and listlen() and then using ListGetAt() you can get that random ID and then query the DB again to pull back that record. On 8/23/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: All, I'm doing a

RE: CFQUERY of non-swequential primary key ids

2006-08-23 Thread Ben Nadel
Subject: RE: CFQUERY of non-swequential primary key ids How very inefficient. How about something like this: cfquery name=get_vid_ids datasource=#datasource# SELECT vidwee_id FROM vidweek /cfquery cfset idList=valueList(get_vid_ids.vidwee_id) cfset idPosition=randRange(1,listLen(idList