M
maxvalery
Hi,
I got about 50 meal names in a table, each meal has a category. I need
to loop thought the meals in such a way that the category name is
displayed at the top of each group. For instance,
I need:
Categ. Name 1
Meal 1
Meal 2
Meal 3
Categ. Name 2
Meal 4
Meal 5
Meal 6
I can do:
Categ. Name 1
Meal 1
Categ. Name 1
Meal 2
Categ. Name 1
Meal 3
Categ. Name 1
Meal 4
My code:
sql_string = "SELECT newmenu_name, newmenu_price, newmenu_desc,
cat_desc, cat_tagline FROM newmenu_meals, newmenu_categories WHERE
cat_name=newmenu_cat;"
rs.Open sql_string, conn
Do Until rs.EOF
response.write("<b>" & rs("newmenu_name") & "</b><br />")
response.write("<em>" & FormatCurrency(rs("newmenu_price")) &
"</em><br />")
response.write(rs("newmenu_desc") & "<br /><br /><br />")
rs.movenext
Loop
How to I move the category name outside of the rs loop?
Thanks!
I got about 50 meal names in a table, each meal has a category. I need
to loop thought the meals in such a way that the category name is
displayed at the top of each group. For instance,
I need:
Categ. Name 1
Meal 1
Meal 2
Meal 3
Categ. Name 2
Meal 4
Meal 5
Meal 6
I can do:
Categ. Name 1
Meal 1
Categ. Name 1
Meal 2
Categ. Name 1
Meal 3
Categ. Name 1
Meal 4
My code:
sql_string = "SELECT newmenu_name, newmenu_price, newmenu_desc,
cat_desc, cat_tagline FROM newmenu_meals, newmenu_categories WHERE
cat_name=newmenu_cat;"
rs.Open sql_string, conn
Do Until rs.EOF
response.write("<b>" & rs("newmenu_name") & "</b><br />")
response.write("<em>" & FormatCurrency(rs("newmenu_price")) &
"</em><br />")
response.write(rs("newmenu_desc") & "<br /><br /><br />")
rs.movenext
Loop
How to I move the category name outside of the rs loop?
Thanks!