I have two tables:
Categories and Brochures. Each added brochure gets a foreign key from the catagory table. I want to output a list of brochures, with title of the catagory. I'm having trouble figuring out a good way to do that. What I have so far:
And to display them:
Right here I want to output the catagory name, #qryGetCategories.strCatagory#
based on the foreign key #qryListBrochures.strCaregoryFK#
I'm looking for the best way to do that. Any help is appreciated!
putting the "new" in "newb".....
Categories and Brochures. Each added brochure gets a foreign key from the catagory table. I want to output a list of brochures, with title of the catagory. I'm having trouble figuring out a good way to do that. What I have so far:
Code:
<cfquery name="qryListBrochures" datasource="application.dsn">
SELECT intBrochureIDPK,strTitle,dtDateModified,strCategoryFK
FROM tableBrochures
ORDER BY strCategoryFK, dtDateModified DESC
</cfquery>
<cfquery name="qryGetCategories" datasource="application.dsn">
SELECT intCategoryPK,strCategory,intSortOrder
FROM tableCategory
</cfquery>
And to display them:
Code:
<table border="0" cellspacing="2" cellpadding="2" align="center">
<tr>
<td class="bigblack" bgcolor="#c8e2d0" width="100">Date:</td>
<td class="bigblack" bgcolor="#c8e2d0" width="368">Title</td>
<td class="bigblack" bgcolor="#c8e2d0" width="127">Category</td>
<td width="36"></td>
<td width="36"></td>
</tr>
<cfoutput query="qryListBrochures">
<tr bgcolor="###iif(currentrow MOD 2,DE('ffffff'),DE('efefef'))#">
<td width="100" class="copy">#DateFormat(dtDateModified, "MM-DD-YYYY")#</td>
<td width="368" class="copy">#strTitle#</td>
<td width="127" class="copy">
based on the foreign key #qryListBrochures.strCaregoryFK#
Code:
</td>
<td align="center" valign="middle" bgcolor="red" class="copy" width="36"><a href="BrochureDelete.cfm?varBrochurePK=#intBrochurePK#" onClick="return confirm('Are you sure?');">delete</a></td>
<td class="copy" align="center" valign="middle" width="36"><a href="BrochureEdit.cfm?varNewsIDPK=#intBrochurePK#">edit</a></td>
</tr></cfoutput>
</table>
I'm looking for the best way to do that. Any help is appreciated!
putting the "new" in "newb".....