Have you tried outputting the random value to see what it is ?

> -----Original Message-----
> From: Ian Westbrook [mailto:[EMAIL PROTECTED] 
> Sent: 25 September 2003 10:05
> To: cfug dev list
> Subject: [ cf-dev ] odd...
> 
> 
> I want to output an 'editor's pick' on the front page of my 
> site - I've selected 5 records from the Diary as edpicks, and 
> am using this code:
> 
> <cfquery datasource="#dsn#" name="pickids">
> SELECT id 
> FROM diary
> WHERE edpick = 'yes'
> </cfquery>
> 
> <cfset list = valuelist(pickids.id)>
> <cfset picklist = ListLen(list)>
> <cfset place = randRange(1,picklist)>
> <cfset randpick = ListGetAt(list, place)>
> 
> <cfquery datasource="#dsn#" name="edrandpick"> 
>     SELECT diary.id AS diaryid, diary.title, diary.startdate, 
> diary.enddate, diary.directoryid, diary.artform AS 
> diaryartform, diary.eventimage, diary.company, directory.id 
> AS directoryid, directory.fullname AS fullname, 
> directory.town, towns.id AS townid, towns.town, artforms.id, 
> artforms.artform AS artform
>     FROM diary, directory, towns, artforms
>     WHERE (len(diary.eventimage) > 0)
>  AND
>  (( diary.startdate >= #nowdate#)
>  or
>  ( diary.enddate >= #nowdate#))
>  AND diary.directoryid = directory.id
>  AND diary.artform = artforms.id
>  AND directory.town = towns.id
>  AND diary.id = #variables.randpick#
> </cfquery> 
> 
> most of the time it works fine, but sometimes the random 
> event isn't output at all (so I guess edrandpick.RC=0). 
> Anyone any idea why?
> 
http://test.artsoutheast.co.uk to see it in action (assuming you _do_
see it, of course, if not reload the page a few times).

TIA

Ian W 



-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to