2 Replies Latest reply on Apr 7, 2008 6:40 AM by ssailer

    CFDIRECTORY - filtering images

    ssailer Level 1
      I have a personals web site where the database has a field indicating the gender of a member; 1 for male, 2 for female. How can I get a list of all images using cfdirectory of only the men, or only the women? Thanks!
        • 1. Re: CFDIRECTORY - filtering images
          Level 7
          obviously, cfdirectory has no idea if your member is M or F or which
          image belongs to which member, only your db does...
          so QoQ is your friend:
          a) get all images with cfdirectory
          b) select necessary records from db - you db must have a field for the
          image filename which will be compared to the results of cfdirectory query
          c) do QoQ to combine the 2 queries and select only images of M or F

          sample code to select all images of M members:
          <cfdirectory name="dirQuery" ...>
          <cfquery name="dbQuery" ...>
          SELECT imageid, imagefilename, gender
          FROM images
          WHERE gender = 'M'
          <cfquery name="qoq" dbtype="query">
          SELECT *
          FROM dirQuery, dbQuery
          WHERE dirQuery.name = dbQuery.imagefilename


          Azadi Saryev
          • 2. Re: CFDIRECTORY - filtering images
            ssailer Level 1
            yes, that worked. Thank you!