Print Page | Close Window

html within response.write

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=11541
Printed Date: 31 March 2026 at 8:41am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: html within response.write
Posted By: ainsworth14
Subject: html within response.write
Date Posted: 15 August 2004 at 2:39pm

 hi

what i am trying to do is display a link when my audio field in the db is not empty

the entry in my audio field corresponds to the ID field.

to save space in my DB i want only to enter '1650' in to the DB audio field and then for my asp page to display the link:

<a href="audio\1650.mp3">listen</a> on my page, i currently have the following code

<%
  
  If isNull(rsResults("audio")) THEN
  response.write ""
  ELSE
   response.write "<a href=""audio\" & rsResults("audio") & ".mp3""> listen </a>"
   END IF
   %>

but all i get in my url is audio\.mp3

why wont it read the reResults bit? any ideas?

thanks

mark




Replies:
Posted By: dpyers
Date Posted: 15 August 2004 at 4:54pm

Null is not the same as "". A string or a data base field that has been set to "" actually has an end-of-string character. A data base field set to Null doesn't have it. If you compare the two, they will be different.

Check to see if your db initializes the audio field to "" or null. If the field is defined as numeric, change the IsNull to IsNumeric

Also, try doing a response.write rsresults("audio") just before the If statement



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

Lead me not into temptation... I know the short cut, follow me.


Posted By: ainsworth14
Date Posted: 16 August 2004 at 2:16pm

hi

all working now, thanks a lot, the code i pasted above actually works today?!

i tried the response.write like above then took it off and it worked?!!

many thanks

mark



Posted By: dpyers
Date Posted: 16 August 2004 at 2:35pm

Originally posted by ainsworth14 ainsworth14 wrote:

i tried the response.write like above then took it off and it worked?!!

lol - could have been a cache problem This piece of code helps alleviate cache problems, but nothing works 100%

    pStr = "private, no-cache, must-revalidate" 
    Response.ExpiresAbsolute = #2000-01-01# 
    Response.AddHeader "pragma", "no-cache" 
    Response.AddHeader "cache-control", pStr 



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

Lead me not into temptation... I know the short cut, follow me.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net