Simple ASP Code Question

Sharky Forums


Results 1 to 11 of 11

Thread: Simple ASP Code Question

  1. #1
    Thread Killer Delphi00's Avatar
    Join Date
    Jun 2003
    Location
    Bay Area, CA
    Posts
    3,327

    Simple ASP Code Question

    Why doesn't the following page display on Brinkster (or any other host which support ASP)?

    <%
    Option Explicit
    Response.Expires = -1000

    Response.Write("<head><title>Classified: For Sale</title></head>")
    Response.Write("<STYLE TYPE='TEXT/CSS'>")
    Response.Write("<!--")
    Response.Write("A { color:black ; text-decoration: none;}")
    Response.Write(".content { color:black ; font-size:12; font-family:arial;}")
    Response.Write(".content2 { color:black ; font-size:12; font-weight: bold; font-family:arial;}")
    Response.Write(".form1 { background-color: white;border:1px #000000 solid; color:#000000 ; font-size:10; font-family:arial;}")
    Response.Write("-->")
    Response.Write("</STYLE>")
    Response.Write("<body bgcolor=#33669A>")
    Response.Write("<table align=center width=800 border="0" cellspacing="1" cellpadding="1">")
    Response.Write("<tr bgcolor=#EEEEEE>")
    Response.Write("<td bgcolor=#FFC800 align=center><font style='color:#000000 ; font-size:9; font-family:arial; font-weight:bold;'>Classified: For Sale</font></td>")
    Response.Write("</tr>")
    Response.Write("<tr bgcolor=#EEEEEE>")
    Response.Write("<td valign=top>")
    Response.Write("<table width="800" border="0" width="582" cellspacing="0" cellpadding="0">")
    Response.Write("<tr>")
    Response.Write("<td width="62"><font class=content2>Browse:</font></td>")
    Response.Write("<td width="208"><font class=content2><a href="bookssale.htm">&#185;&nbsp;Books</font></td>")
    Response.Write("<td width="416" align="right"><font class=content2><a href="register.htm">&#185;&nbsp;Register</a></font></td>")
    Response.Write("<td align="right"><font class=content2>Search:</font></td>")
    Response.Write("</tr>")
    Response.Write("<tr>")
    Response.Write("<form name=searchform action=search.asp METHOD=POST>")
    Response.Write("<td width="62">&nbsp;</td>")
    Response.Write("<td width="208"><a href="computerpartssale.htm"><font class=content2>&#178;&nbsp;Computer Parts</font></td>")
    Response.Write("<td width="416" align="right"><font class=content2><a href="login.htm">&#178;&nbsp;LOGIN</a></font></td>")
    Response.Write("<td align="right">&nbsp;<INPUT TYPE=TEXT NAME=SearchField SIZE=20 CLASS=form1></td>")
    Response.Write("</form>")
    Response.Write("</tr>")
    Response.Write("<tr>")
    Response.Write("<td width="62">&nbsp;</td>")
    Response.Write("<td width="208"><font class=content2><a href="miscellaneoussale.htm">&#179;&nbsp;Miscellaneous</td>")
    Response.Write("<td valign=top width="416" align="right"><font class="content2"><a href="help.htm">³&nbsp;Help</a></font></td>")
    Response.Write("<td align="right">&nbsp;</td>")
    Response.Write("</tr>")
    Response.Write("</table>")
    Response.Write("</td>")
    Response.Write("</tr>")
    Response.Write("</table>")
    Response.Write("<table align=center width=804 border="0" cellspacing="1" cellpadding="1">")
    Response.Write("<tr align=center bgcolor=#FFC800 style='color:black; font-weight: bold'>")
    Response.Write("<td>font class=content2>Course No.</font></td>")
    Response.Write("<td><font class=content2>Title</font></td>")
    Response.Write("<td><font class=content2>Description</font></td>")
    Response.Write("<td><font class=content2>Price</font></td>")
    Response.Write("<td><font class=content2>Contact</font></a></td>")
    Response.Write("</tr>")
    Response.Write("<tr>")
    Response.Write("<td bgcolor=#FFC800 colspan=100 align=right><font style='color:#000000 ; font-size:11; font-family:arial; font-weight: bold;'>Count: " & counter & "/ALL</font></td>")
    Response.Write("</tr>")
    Response.Write("</table>")
    Response.Write("</body>")
    %>
    It's REALLY simple html typed out useing Response.Write! This is really frustrating, can anyone PLEASE help me out?
    Last edited by Delphi00; 01-31-2004 at 11:01 AM.
    Rig:
    P4 2.4C @ 3.0Ghz | Abit IC7 | Thermalright SLK 947U + Enermax 90mm | Scythe Ultra Kaze 120mm | Corsair 3GB | PowerColor HD3850 AGP | Antec SLK3700AMB | Enermax Whisper II 535W | Hercules Fortissimo III 7.1 | Samsung 931B | Logitech Z-2300 | WinXP Pro

  2. #2
    Hammerhead Shark
    Join Date
    Feb 2001
    Posts
    1,612
    Response.Write("<table align=center width=800 border="0" cellspacing="1" cellpadding="1">")

    ^^ That's no good.

  3. #3
    . ksuohio's Avatar
    Join Date
    Oct 2001
    Location
    Atlanta, GA
    Posts
    2,721
    I'm not seeing a beginning and ending html tag. Also, why did you the Resonse.write method? You could have just typed the html code since it doesn't appear that you are using any additional scripting.
    ---------------------------------------------------------------
    - Asus M50 Laptop - C2D T9300 - 4 gig RAM - Radeon HD 3650 - Vista x64 Ultimate

    - Intel i7-3770K - Asus P8Z77-V DELUXE - 32gig RAM - Radeon HD7970 Ghz - Plextor M3 256GB/120GB OCZ Vertex3
    - LG BluRay - Razor Blackwidow Ultimate Keyboard - Logitech G9x
    - HP ZR2740w/Asus LCD - W7 Ultimate

    ---------------------------------------------------------------

  4. #4
    Thread Killer Delphi00's Avatar
    Join Date
    Jun 2003
    Location
    Bay Area, CA
    Posts
    3,327
    Thanks for the reply guys

    Originally posted by ksuohio
    I'm not seeing a beginning and ending html tag. Also, why did you the Resonse.write method? You could have just typed the html code since it doesn't appear that you are using any additional scripting.
    It doesn't need an HTML tag and i stripped off my asp code becasue they were not relevant to the problem...

    Thank Strogian, I think that's where my prob is, thanks!

    EDIT:
    Do you guys know any betetr way other than having to type out response.write for everyline of html code? thanks...

    EDIT2:
    Why doesn't this work?
    sSQL = "SELECT Course, Title, Description, Price, Contact FROM Sale ORDER BY Course Where Type='Book'"
    The WHERE part gives an error...
    Last edited by Delphi00; 01-31-2004 at 12:57 PM.
    Rig:
    P4 2.4C @ 3.0Ghz | Abit IC7 | Thermalright SLK 947U + Enermax 90mm | Scythe Ultra Kaze 120mm | Corsair 3GB | PowerColor HD3850 AGP | Antec SLK3700AMB | Enermax Whisper II 535W | Hercules Fortissimo III 7.1 | Samsung 931B | Logitech Z-2300 | WinXP Pro

  5. #5
    Catfish
    Join Date
    Jan 2004
    Posts
    174
    You need to place your where statement ahead of your order by statement.

    Order by sorts the output of your query, and you can't sort the order before you have defined the focus of your query.

  6. #6
    Thread Killer Delphi00's Avatar
    Join Date
    Jun 2003
    Location
    Bay Area, CA
    Posts
    3,327
    Originally posted by Gary K
    You need to place your where statement ahead of your order by statement.

    Order by sorts the output of your query, and you can't sort the order before you have defined the focus of your query.
    THANK YOU!!!!!!!!

    BTW: Do you know a more efficient way to deal with the HTML i'm using instead of using response.write every time?
    Last edited by Delphi00; 01-31-2004 at 06:20 PM.
    Rig:
    P4 2.4C @ 3.0Ghz | Abit IC7 | Thermalright SLK 947U + Enermax 90mm | Scythe Ultra Kaze 120mm | Corsair 3GB | PowerColor HD3850 AGP | Antec SLK3700AMB | Enermax Whisper II 535W | Hercules Fortissimo III 7.1 | Samsung 931B | Logitech Z-2300 | WinXP Pro

  7. #7
    Hammerhead Shark
    Join Date
    Feb 2001
    Posts
    1,612
    Is there a reason you can't just do something like this:

    <%
    option explicit
    response.expires = -1000
    %>

    <head>
    <title>blah</title>
    </head>

    ...

  8. #8
    Thread Killer Delphi00's Avatar
    Join Date
    Jun 2003
    Location
    Bay Area, CA
    Posts
    3,327
    Originally posted by Strogian
    Is there a reason you can't just do something like this:

    <%
    option explicit
    response.expires = -1000
    %>

    <head>
    <title>blah</title>
    </head>

    ...
    can i do this?

    <%
    option explicit
    response.expires = -1000
    %>

    <head>
    <title>blah</title>
    </head>

    <%
    (some ASP code)
    %>
    Rig:
    P4 2.4C @ 3.0Ghz | Abit IC7 | Thermalright SLK 947U + Enermax 90mm | Scythe Ultra Kaze 120mm | Corsair 3GB | PowerColor HD3850 AGP | Antec SLK3700AMB | Enermax Whisper II 535W | Hercules Fortissimo III 7.1 | Samsung 931B | Logitech Z-2300 | WinXP Pro

  9. #9
    . ksuohio's Avatar
    Join Date
    Oct 2001
    Location
    Atlanta, GA
    Posts
    2,721
    Originally posted by Delphi00
    can i do this?

    <%
    option explicit
    response.expires = -1000
    %>

    <head>
    <title>blah</title>
    </head>

    <%
    (some ASP code)
    %>
    Yes, basically, any place that you want to script just enclose it in <% %> and you should be set. That's why I was questioning using the response.write method when the page was mostly html. Response.write is most useful when the text is dynamic.
    ---------------------------------------------------------------
    - Asus M50 Laptop - C2D T9300 - 4 gig RAM - Radeon HD 3650 - Vista x64 Ultimate

    - Intel i7-3770K - Asus P8Z77-V DELUXE - 32gig RAM - Radeon HD7970 Ghz - Plextor M3 256GB/120GB OCZ Vertex3
    - LG BluRay - Razor Blackwidow Ultimate Keyboard - Logitech G9x
    - HP ZR2740w/Asus LCD - W7 Ultimate

    ---------------------------------------------------------------

  10. #10
    Hammerhead Shark
    Join Date
    Feb 2001
    Posts
    1,612
    you can even do this:

    <%
    IF something THEN
    %>
    html text
    <%
    ELSE
    %>
    other html text
    <%
    END IF
    %>

  11. #11
    Thread Killer Delphi00's Avatar
    Join Date
    Jun 2003
    Location
    Bay Area, CA
    Posts
    3,327
    wow i didn't know that...thanks ppl!
    Rig:
    P4 2.4C @ 3.0Ghz | Abit IC7 | Thermalright SLK 947U + Enermax 90mm | Scythe Ultra Kaze 120mm | Corsair 3GB | PowerColor HD3850 AGP | Antec SLK3700AMB | Enermax Whisper II 535W | Hercules Fortissimo III 7.1 | Samsung 931B | Logitech Z-2300 | WinXP Pro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •