• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFDIRECTORY - filtering images

Participant ,
Apr 06, 2008 Apr 06, 2008

Copy link to clipboard

Copied

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!
TOPICS
Advanced techniques

Views

419

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 06, 2008 Apr 06, 2008
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" .....

Votes

Translate

Translate
LEGEND ,
Apr 06, 2008 Apr 06, 2008

Copy link to clipboard

Copied

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>
<cfquery name="qoq" dbtype="query">
SELECT *
FROM dirQuery, dbQuery
WHERE dirQuery.name = dbQuery.imagefilename
</cfquery>

hth

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 07, 2008 Apr 07, 2008

Copy link to clipboard

Copied

LATEST
yes, that worked. Thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation