hello, I am getting some odd output results, and I would guess I am missing something pretty obvious, but has anyone any suggestions?
I have a list of numbers, which correspond to id's in a db. I need to loop over this list, query the DB each time to get the name of the region, then display this. I then need to find all instances of wine that correspond to that region, and display all of them below the name of the region. All seems to work, except the wines are one out of sync, in other words, say the first region is Champagne and the second Beaujolais. Nothing is displayed under champagne, and the champagnes are displayed under Beaujolais. Sorry, probably not the clearest description, but can anyone help? Here is the code: <cfloop index="ListElement" list="#listofregions#" delimiters=","> <cfquery name="getregionname" datasource="#Request.App.dsn#"> SELECT * FROM tbl_wineregions WHERE wine_regionID = #ListElement# </cfquery> <cfoutput>#ListElement#</cfoutput> <br> <span class="glynd1"> <br> </span><span class="title2"><cfoutput>#UCase(getregionname.wine_region)#</cfoutput></span ><span class="glynd1"><br> </span> <table width="490" border="0" cellspacing="0" cellpadding="1"> <tr> <td> <table width="490" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="40" height="13"> <div align="center" class="title3">YEAR</div> </td> <td width="311" height="13"> </td> <td height="13" width="48"> </td> <td width="48" class="title3"> <div align="center">BOTTLE</div> </td> <td width="49" height="13"> </td> </tr> </table> </td> </tr> <!--- now lets pull out the half bottles for this region ---> <cfquery name="getwine" datasource="#Request.App.dsn#"> SELECT * FROM tbl_wines WHERE price_per_halfbottle <> 0.00 AND region = #ListElement# </cfquery> <!--- <cfquery dbtype = "query" name = "getwine"> SELECT * FROM gethalfregions WHERE region = #ListElement# AND </cfquery> ---> <cfoutput>#ListElement#</cfoutput> STOP <!--- finally, lets output over these and display them ---> <cfoutput query="getwine"> <tr> <td> <table width="490" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="40" height="13" bgcolor="##ccccff"> <div align="center" class="titleSMALLCopy"><span class="titleSMALLCopy">#year#</span></div> </td> <td width="311" height="13" bgcolor="##ccccff" class="titleSMALLCopy"> #name#</td> <td height="13" bgcolor="##ccccff" width="5"> </td> <cfif getwine.image_file IS NOT "" AND getwine.tasting_notes IS NOT ""> <td width="48"><a href="show_details.cfm?wine=#getwine.wineID#" target="_new"><img src="buttons/notesandview.gif" alt="" width="48" height="22" border="0"></a></td> <cfelseif getwine.image_file IS NOT "" AND getwine.tasting_notes IS ""> <td width="48"><a href="show_details.cfm?wine=#getwine.wineID#" target="_new"><img src="buttons/view.gif" width="48" height="22" border="0"></a></td> <cfelseif getwine.image_file IS "" AND getwine.tasting_notes IS NOT ""> <td width="48"><a href="show_details.cfm?wine=#getwine.wineID#" target="_new"><img src="buttons/notes.gif" alt="" width="48" height="22" border="0"></a></td> <cfelse> <td width="48" height="13" bgcolor="##ccccff"></td> </cfif> <td height="13" bgcolor="##ccccff" width="48"> <div align="center" class="glynd1"><span class="titleSMALLCopy">£#DecimalFormat(price_per_halfbottle)# <cf if getwine.limited_stocks IS "yes"><strong>*</strong></cfif></span></div> </td> <td width="48" height="13"> <div align="right"><a href="add_wine.cfm?wineID=#getwine.wineID#"><img src="buttons/addorder.gif" alt="" width="48" height="22" border="0"></a></div> </td> </tr> </table> </td> </tr> </cfoutput> </cfloop> cheers will ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Archives: http://www.mail-archive.com/cf-community@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists