imageColumnName isn't your column name, it's a variable!

I would suggest

<cfquery datasource="#dsn#" name="qGetFilenames">
  SELECT #imageColumnName# AS mycol FROM products
  UNION
  SELECT #imageColumnName# AS mycol FROM dolls
</cfquery>
cfset fileNames = #ValueList(qGetFilenames.mycol)# />

Pascal

> -----Original Message-----
> From: Donna French [mailto:[EMAIL PROTECTED]
> Sent: 17 November 2004 19:37
> To: CF-Talk
> Subject: Re: Help! Error on ValueList
> 
> I had left the CFAbort from yesterday. Removed that, then the query
> name was wrong in part of the output. So I've corrected that and have
> the current code and error:
> 
> Code:
> <html>
> <head>
> <title>Images Cleanup</title>
> <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
> </head>
> 
> <body>
> <!--- CONFIGURATION --->
> 
> <!--- Change these to suit your server --->
> <cfset dsn = "mydsn">
> <cfset imagesDirectory = "c:\inetpub\lanescollectibles\images">
> <cfset imagesSubdirectories = "400,200,85">
> <!--- SQL Server is not case-sensitive, so lanesid = lanesID --->
> <cfset imageColumnName = "lanesid">
> <!--- Change this to FALSE to really do the deletes... --->
> <cfset testMode = true />
> 
> <!--- /CONFIGURATION --->
> 
> 
> <!--- Get all of the filenames --->
> <cfquery datasource="#dsn#" name="qGetFilenames">
>   SELECT #imageColumnName# FROM products
>   UNION
>   SELECT #imageColumnName# FROM dolls
> </cfquery>
> 
> <!--- Turn the filenames into a list --->
> <cfset fileNames = #ValueList(qGetFilenames.imageColumnName)# />
> 
> <!---
>   Loop through the various image subdirectories doing cleanup
> --->
> <cfloop list="#imagesSubdirectories#" index="i">
>   <cfdirectory action="list" directory="#imagesDirectory#\#i#"
> name="qDirectory">
> 
>   <!---
>     Loop over the files in the directory, deleting any that isn't
>     in the list of existing files
>   --->
>   <cfoutput>
>   <cfloop query="qDirectory">
>     <cfif not listFind(fileNames, qDirectory.name)>
>       <cfif not testMode>
>         <cffile action="delete"
> file="#imagesDirectory#\#i#\#qDirectory.name#">
>       <cfelse>
>         Test Mode:  #imagesDirectory#\#i#\#qDirectory.name# would be
> deleted. <br />
>       </cfif>
>     </cfif>
>   </cfloop>
>   </cfoutput>
> </cfloop>
> 
> </body>
> </html>
> 
> Error:
> Error Diagnostic Information
> 
> An error occurred while evaluating the expression:
> 
> 
>  fileNames = #ValueList(qGetFilenames.imageColumnName)#
> 
> 
> 
> Error near line 30, column 7.
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:184638
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