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!
obviously, cfdirectory has no idea if your member is M or F
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
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
WHERE gender = 'M'
<cfquery name="qoq" dbtype="query">
FROM dirQuery, dbQuery
WHERE dirQuery.name = dbQuery.imagefilename