ASP Looping Weird Behavior

J

John

Hi Everyone,

I have a strange little problem which I am having difficulty
overcoming. I have a loop in ASP:
<%
For x=0 to 10
Response.Write("Some text...")
Next
%>

Right after the loop I have some text:
<%
Response.Write("Text After Loop")
%>

For some strange reason, when I run the ASP page I get the output of
the Text first, and the output of the Loop second, even though the text
appears after the loop in the script body, and I need it to appear
after the output of the loop.. I haven't been able to figure this out..
does anyone have any ideas?

I'd like to point out that the above examples are not my actual code,
the Loop is for retrieving and building an html table of a specific
number of records from an SQL Server database, and the Text that's
after the loop is actually a function (which also contains a loop) that
calculates the amount of pages sorted by 10 records/page, depending on
the number of records retrieved from the database, and outputs html
links to the page numbers, example: <a href="script.asp?Page=1">1</a>,
2, 3, ...

Thanks!
 

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

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top