There are a number of ways to do this, but the easiest and not sure if
it is the quickest way.

Is to loop through and do a query to see if that directory is listed in
the database if it isn't then do an insert into the database.

Regards,
Andrew Scott



-----Original Message-----
From: Robert Orlini [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 2 December 2004 7:42 AM
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 - RUWebby
http://www.ruwebby.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185891
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to