//flex table opened by JP

Click to See Complete Forum and Search --> : Response.Write Script


DanielAc
02-07-2002, 09:04 AM
What is the best way I can code this.

I Only want a Response.Write if the field contains a value.

But I want it to use a minimal amount of code. I am sorta what you would call stingy when it comes to how many bytes I want my code to occupy, bad habit sometimes. Anyway...

So if I have:

Response.Write "• <a href='" & rs("fldFavLink1") & "'><font color='blue'>" & Replace(rs("fldFavLink1"),"http://", "") & "</font></a><br>"
Response.Write "• <a href='" & rs("fldFavLink2") & "'><font color='blue'>" & Replace(rs("fldFavLink2"),"http://","") & "</font></a><br>"
Response.Write "• <a href='" & rs("fldFavLink3") & "'><font color='blue'>" & Replace(rs("fldFavLink3"),"http://","") & "</font></a><br>"
Response.Write "• <a href='" & rs("fldFavLink4") & "'><font color='blue'>" & Replace(rs("fldFavLink4"),"http://","") & "</font></a><br>"
Response.Write "• <a href='" & rs("fldFavLink5") & "'><font color='blue'>" & Replace(rs("fldFavLink5"),"http://","") & "</font></a><br><br>"

And the client only decides to add 1 link to his database I do not want the display page to look like:

• www.jenniferknapp.com






What is the best way to go about this?
And also can't the above code be put into some For .. Loop anyway?

Thanks a million!
Daniel Acuff

qball
02-08-2002, 08:48 PM
well, I have lame answers without mo info:

don't include any fields in your rs that are null or change query so each row represent link and loop thru rs. In other words, the answer may lie outside the scope of your question.

simply use for each:


if NOT IsNull(rs("fldFavLink1") then
Response.write(...)
End If