One other option is to run CFDIRECTORY, clear the table and reload it
with the CFDIRECTORY results.

If you were to do this, I would use a named CFLOCK around the code to
ensure that no person hits an empty table while you are updating it.

M!ke 

-----Original Message-----
From: Robert Orlini [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 01, 2004 2:42 PM
To: CF-Talk
Subject: CFDIRECTORY question

I have this cfdirectory code (see below) that I want to read a list of
directory names and then insert into a table. 

However, this script will be running each time a user accesses drop-down
list. I want to list the current directories and any new directory names
that have been added.

At this point it will add the directory names numerous times along with
any new directories.

How can it just add new directories to the table using this cfdirectory
script?

Thanks!
 
<cfdirectory 
   directory="#GetDirectoryFromPath(GetTemplatePath())#" 
   name="myDirectory">
   
<cfloop query="myDirectory">
        <cfif type EQ "dir">
        <CFQUERY name="get" datasource="marketing">
        INSERT INTO directories (name)
                VALUES ('#mydirectory.name#')
                Where #mydirectory.name# != '#name#'
        </CFQUERY>
        </cfif>
</cfloop>

Robert O.
HWW



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - CFDynamics
http://www.cfdynamics.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185872
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to