sql - Display Multiple ASP Items -
i need display multiple asp items. have end tool can add multiple entries, first 2 display. i'm hoping there minor code tweak allow additional pages display. code 2 pages display code follows:
<% dim sql sql = "select * announcement_table ann_status=1" set rs = con.execute(sql) %> <%if not(rs.eof , rs.bof) then%> <p><strong><%=rs("ann_title")%></strong> </p> <p><%=rs("ann_text")%> <%else%> there no announcements. <% end if rs.close set rs = nothing %> </p> <hr size="1" noshade> <% dim sql_, sqlcount sqlcount = "select count(*) announcement_table" set rscount = con.execute(sqlcount) sql_ = "select * announcement_table ann_status <> 1" set rs_ = con.execute(sql_) %> <%if rscount(0)>1 then%> <%if not(rs_.eof , rs_.bof) then%> <a href="announcements_more.asp?ann_id=<%=rs_("ann_id")%>"><%=rs_("ann_title")%></a> <br> <%else%> there no announcements. <% end if rs_.close set rs_ = nothing %> <%end if rscount.close set rscount = nothing %>
this 2nd page:
<% dim sql_ sql_ = "select * announcement_table ann_id=" & intann_id set rs_ = con.execute(sql_) %> <p><strong><%=rs_("ann_title")%></strong> </p> <p><%=rs_("ann_text")%></p> <%rs_.close set rs_ = nothing %>
in second page,you need loop through recordset show multiple values.
<% dim sql_ sql_ = "select * announcement_table ann_id=" & intann_id set rs_ = con.execute(sql_) while not rs_.eof %> <p><strong><%=rs_("ann_title")%></strong> </p> <p><%=rs_("ann_text")%></p> <% rs_.movenext wend rs_.close set rs_ = nothing %>
and check link too.sql injection
Comments
Post a Comment