Qry data to Page

B

BaWork

I have the following data pulled from a db query - it is calculating the
total number of listings for a given category.

CountOfmain_cat_id main_cat_id main_cat
7 1 Clubs
1 2 Accessories
3 3 Apparel
6 4 Instruction
1 5 Course Equipment
2 8 Real Estate
1 9 Employment
1 10 General

I need to display that information on a page, but not it table. I have
an example mocked-up.

http://brettatkin.com/example.gif

Next to each Cat listing, I put the number of ads for that category (5 Ads).

How do I make this happen, take the data from the rs and put it next to
each Category heading?

I need to assign the value of CountOfmain_cat_id to a variable for each
row so that I can reference that variable in the HTML next to each cat
heading.

I'm stuck... Any ideas?

Thanks.

Brett
 
A

Anthony Jones

BaWork said:
I have the following data pulled from a db query - it is calculating the
total number of listings for a given category.

CountOfmain_cat_id main_cat_id main_cat
7 1 Clubs
1 2 Accessories
3 3 Apparel
6 4 Instruction
1 5 Course Equipment
2 8 Real Estate
1 9 Employment
1 10 General

I need to display that information on a page, but not it table. I have
an example mocked-up.

http://brettatkin.com/example.gif

Next to each Cat listing, I put the number of ads for that category (5 Ads).

How do I make this happen, take the data from the rs and put it next to
each Category heading?

I need to assign the value of CountOfmain_cat_id to a variable for each
row so that I can reference that variable in the HTML next to each cat
heading.

I'm stuck... Any ideas?


<table>
<tr><td>
<%
Dim i : i = 0
Do Until rs.EOF

'Place code and markup to render contents here

rs.MoveNext

If Not rs.EOF Then
If (i Mod 2) = 0 Then
Response.Write "</td><td>"
Else
Response.Write "</td></tr><td>"
End If
End If
i = i + 1
Loop
%>
</td></tr>
</table>
 
B

BaWork

Thanks for the help.

This is what I ended up with:

<%
Do Until rs_ad_count.EOF

Select Case rs_ad_count.Fields.Item("main_cat_id").Value

Case "1"
clubs_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "2"
accessories_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "3"
apparel_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "4"
instruction_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "5"
equipment_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "6"
travel_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "7"
services_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "8"
real_estate_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "9"
employment_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "10"
general_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
End Select

rs_ad_count.MoveNext
Loop
%>
 
A

Anthony Jones

BaWork said:
Thanks for the help.

This is what I ended up with:

<%
Do Until rs_ad_count.EOF

Select Case rs_ad_count.Fields.Item("main_cat_id").Value

Case "1"
clubs_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "2"
accessories_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "3"
apparel_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "4"
instruction_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "5"
equipment_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "6"
travel_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "7"
services_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "8"
real_estate_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "9"
employment_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
Case "10"
general_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
End Select

rs_ad_count.MoveNext
Loop
%>

Seems to me that what would be better would be to store the category
description and gif file name in the database and include them in the query
output. The page content is then driven by the DB. If you want to add a
new category you upload a new gif for it and make a change the DB. There
would be no need to modify this page to cope with a new category.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top