ASP Output problem. Please help!!!

Author Message
last

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 1/20/2012
  • Status: offline
ASP Output problem. Please help!!! Friday, January 20, 2012 5:22 AM (permalink)
0
Hi everyone,
please I need your help!!!!!
I have to run a recordset as this following:
room_1 | price_1 | …
room_1 | price_2 | …
room_1 | price_3 | …
room_1 | price_4 | …
room_2 | price_1 | …

room_2| price_2 | …
room_3 | price_1 | …


I would like this output:
room_1:
-          price_1
-          price_2
-          price_3
-          price_4
-          …
room_2:
-          price_1
-         price_2
-          …
room_3:
-          price_1
-          …

I have this code, but dont work because it give me the title of the room (es. room_1) by every price, so like this...
room_1:
-          price_1
room_1:
-          price_2

Here the code:

<%sql = "SELECT * FROM price ORDER BY room_id  ASC"Set rs = conn.execute(sql)
last_room_output = Cint(-1)
Do until rs.eof
%>
<div class="box_price">
<% If Cint(rs("room_id")) <> last_room_output then %> 
<h1 id="idc_<%= rs("room_id") %>"><%=rs("room_title")%></h1>  
<div class="clear">&nbsp;</div> 
<%  End If  %>  
<div class="box_t_price">     
<div><%=rs("tariffe_title")%></div>       
<div class="date">from: <%=rs("price_from")%> to: <%=rs("price_to")%></div>       
<div class="price">&euro; <%=rs("room_price")%></div>       
<div class="clear">&nbsp;</div></div>
<%
rs.movenext
loop
%>

Thanks a lot
Bye

<message edited by last on Friday, January 20, 2012 5:37 AM>
 
#1
    iarturo

    • Total Posts : 4
    • Scores: 0
    • Reward points : 0
    • Joined: 2/7/2012
    • Status: offline
    Re:ASP Output problem. Please help!!! Tuesday, February 07, 2012 12:50 PM (permalink)
    0
    Hi !!
    Try a Do While...
    Not testing, but this is the idea, I hope you will help...
     
     
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <%
    sqlroom = "SELECT ROOM_ID FROM PRICE GROUP BY ROOM_ID ORDER BY 1"
    Set rsROOM = conn.execute(sqlroom)
    %>
    <%
    do while (not rsROOM.EOF)
    room = rsROOM("ROOM_ID")
    sql = "SELECT * FROM price where ROOM_ID = '"&room&"'"
    Set rs = conn.execute(sql)
    last_room_output = Cint(-1)
    Do until rs.eof
    %>

    <div class="box_price">
    <div class="box_t_price"> <div <%=room%> </div>
    <div><%=rs("tariffe_title")%></div>
    <div class="date">from: <%=rs("price_from")%> to: <%=rs("price_to")%></div>
    <div class="price">&euro; <%=rs("room_price")%></div>
    <div class="clear">&nbsp;</div>
    </div>
    <%
    rs.movenext
    loop
    rsROOM.MoveNext
    Loop
    %>
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9