0

I'm using a Query of Queries to output list of files in a folder with the filter DateLastModified DESC. It works fine locally, but not on the remote site.

<!---get list of files in directory to link to for lessons--->
<CFDIRECTORY NAME="myfiles"
     DIRECTORY="#ExpandPath('uploaded_files')#" 
     FILTER="*.*"
     SORT="DateLastModified DESC">

<cfquery dbtype="query" name="todays_files">
    SELECT *
    FROM   myfiles
    WHERE  #DatePart("d", myfiles.DateLastModified)# = #DatePart("d", lessons.lesson_date)#
</cfquery>

<p>
    <cfoutput>
    <a href="uploaded_files/#todays_files.Name#" 
           target="_blank">#todays_files.Name#</a><br />
    </cfoutput>
</p>

Could this be due to time differences? I'm in the Czech Republic and my site is hosted in the USA.

Thanks for your input.

Leigh
  • 28,765
  • 10
  • 55
  • 103
Shalinko
  • 21
  • 1
  • 4
  • You need to define "not working". Does it error? If so, what error? Do you get unexpected output? If so, please show the input, the output you expect, and the output you got. Etc, etc. – MatBailie Mar 05 '14 at 16:46
  • 1
    My first guess is that the directory doesn't exist on the server. My second is that the process running the query doesn't have permissions to access the directory. – Gordon Linoff Mar 05 '14 at 16:50
  • Are you sure you don't want to `` ? – James A Mohler Mar 05 '14 at 16:52
  • Anything to do with different date formats in the input (USA uses MM/dd/YY)? – jean Mar 05 '14 at 16:55
  • @Shalinko no output? Your link should always be showing up since you didn't link to your query. Can you post the generated HTML? – Matt Busche Mar 05 '14 at 17:03
  • MatBailie sorry yes...output locally file list displays fine; remotely there are no errors, just no output. Gordon Linoff directory does exist, I took out the where clause and it outputs fine James A Mohler I can't use output query as I'm already inside an output query Jean...could be, so I will have do a DateFormat or CreateDate I suppose, if that's the problem? Will try now, thanks. – Shalinko Mar 05 '14 at 17:06
  • This is remote source code:


    And this the local source code

    test.pdf

    – Shalinko Mar 05 '14 at 17:13
  • _I can't use output query as I'm already inside an output query_ then use a loop; ` ...` – Miguel-F Mar 05 '14 at 17:50
  • *It works fine locally* I doubt it. QoQ's do not support the `DatePart` function, so that query would not do what you are expecting. It would only compare the values **in the first row** of the two queries... – Leigh Mar 05 '14 at 19:16
  • @Miguel-F yes of course..doh! But now I realise that a much better and reusable way (with other students) will be to create a directory named with lesson_ID when adding a new lesson and keeping all relevant files to each lesson rather than try to link them with the date....then loop through that specific directory. Sorry if I wasted time, but I'm learning a hell of a lot here...thanks v much! – Shalinko Mar 06 '14 at 08:10

0 Answers0