ASP / Sql question
Hi,
As a Web Design major, I am in no way an expert in programming and have taken on an approach of learn as you go. I started out thinking that an include file was the "coolest" thing in the world, but only now I am starting to begin to scratch the surface of ASP/Sql.
A friend of mine is having me make his web site for his restaurant as a favor. As with any restaurant website, they want to feature their menu online. This menu is rather large and has something like 120+ items on the menu. Instead of hard coding it all in html, I created an access database with 2 tables. A table that lists the category and then a table that has the menu items, prices, and a lookup field so I can pick the category. I am able to successfully connect to the database and display all the data on the page. However, I'm trying to categorize the page by the menu category. For instance, I want to have a bold heading that says "Beverages," and then have the beverages listed below it. I cheated a little and used "SQL View" in Access and I think I'm on the right track. I can get it to display 1 Category and all the items within that category, but I cannot figure out how to get all the categories to display with all of the items.
Below is the code that I used:
SQL = "SELECT tbl_category.tbl_category_menuItem, tbl_menu.*, tbl_menu.tbl_menu_category FROM tbl_category INNER JOIN tbl_menu ON tbl_category.ID = tbl_menu.tbl_menu_category WHERE (((tbl_menu.tbl_menu_category)=1));"
Set tblMenu = Server.CreateObject("ADODB.recordSet")
tblMenu.Open SQL, Conn, 1, 3
count = 0
Response.Write("<table align=""center"" class=""standard"" cellspacing=""0"" cellpadding=""3""><tr>")
Do While NOT tblMenu.EOF
count = count + 1
n = count mod 2
%>
<td width="45%"><%=tblMenu("tbl_menu_name")%></td>
<td align="center" width="5%"><%=tblMenu("tbl_menu_price")%></td>
<td> </td>
<%
If (n = 0) Then
Response.Write("</tr><tr>")
End If
tblMenu.Movenext
Loop
Response.Write("</table>")
tblMenu.Close
Set tblMenu = Nothing
Am I even on the right track? Any help or suggestions would be really appreciated. Thanks for your help and time.
Joe
|