ah, i get it
you want only one item, and you also want all the categories
in fact, it appears likely that the item might not even have any categories (yet)
i would do this with two queries
nested CFOUTPUTs are possible if you use the GROUP= parameter of the CFOUTPUT tag on the outer ones, but this wouldn't apply in your situation
Code:
<CFQUERY NAME="getitem">
select itemname
, itemdescription
, itemprice
, category
from tbl_items
where itemname = 'widget'
</CFQUERY>
<CFQUERY NAME="getcategories">
select categoryID
, category
from tbl_categories
order by category
</CFQUERY>
<form name="edititem" method="post">
<CFOUTPUT>
<input type="text" name="itemname"
value="#getitem.itemname#">
<input type="text" name="itemdescription"
value="#getitem.itemdescription#">
<input type="text" name="itemprice"
value="#getitem.itemprice#">
</CFOUTPUT>
<select name="categories">
<CFOUTPUT QUERY="getcategories">
<option value="#getcategories.categoryID#"
<CFIF getitem.category EQ getcategories.categoryID>
selected="selected"
</CFIF>
>#getcategories.category#</option>
</CFOUTPUT>
</select>
note how the CFIF detects when the item has the category
if you need the item's category as the first option, that'll take a different bit of code
Bookmarks