[thelist] CurrentRow in CF AMENDED RESPONSE!!!!

Andy Osborne andyosborne at hotmail.com
Sun Jun 17 19:42:04 CDT 2001


Make a query to the database to obain number of records present eg. select
count(tablename.column_name) as Number_Rows

This will give you number of rows in selected column. Assign this to a
session variable. (create a CFAPPLICATION template)

Then query database again, extracting records required. Assign all the
records retrieved to a 2-D Session.array. This array containing the database
query can be passed between templates

eg recordset = NewArray(2)
<cfoutput query="Getdata">
recordset[i][1]="#first name#"
recordset[i][2]="#last name#"
<cfset i=i+1>
and so on..

Achieve this with CFOUTPUT, and an incrementing variable.

You can then decide how many records you want to display, and access the
array accordingly. eg. 16 records - display in groups of 5 -
numtodisplay=INT(numrecords/5) (gives you 3 groups) & remainder =
MOD(numrecords/5) for any remaining images.

Hope this helps


>From: "Aaron Cole" <awcole72 at hotmail.com>
>Reply-To: thelist at lists.evolt.org
>To: thelist at lists.evolt.org
>Subject: [thelist] CurrentRow in CF
>Date: Mon, 11 Jun 2001 22:54:28 -0700
>I'm trying to recreate a feature I've seen on a lot of sites where you get 
>dynamic record count.  So, if there are 5 pictures in a set and you're
>viewing the third one, it will say 3 of 5.
>I thought I had it figured out by using #CurrentRow# of #RecordCount#.
>Alas, no.
>When I output this I get all five possibilities at once.  Arrgh!! So close.
>Can someone point me in the right direction?
>Get your FREE download of MSN Explorer at http://explorer.msn.com
>For unsubscribe and other options, including
>the Tip Harvester and archive of TheList go to:
>http://lists.evolt.org Workers of the Web, evolt !

Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

More information about the thelist mailing list