Hey guys, I have to admit to be being more PHP than ASP - although sods law am working on a project in ASP. Am finding I can take some of the principals across from PHP but theres just one point i am struggling with.
I have this function to loop through and check for banners in a database then display on the site.
<%
function getCurrentBanners()
dim db
Set db=Server.CreateObject("adodb.recordset")
SQL = "SELECT * FROM website_banners"
db.open SQL, tiebaConn
current_banners = "<div id=""rotator""><ul>"
count = 0
if not(db.eof) then
do while not db.eof
if count <> 0 then
current_banners = current_banners & "<li>" & vbCrLf
else
current_banners = current_banners & "<li class=""show"">" & vbCrLf
end if
current_banners = current_banners & "<img alt=""" & db("strBannerAlt") &""" src=""/banners/uploads/" & db("flBannerImage") &""">" & vbCrLf
current_banners = current_banners & "</li>" & vbCrLf
db.movenext
count = count +1
Loop
End If
current_banners = current_banners & "</ul></div>"
db.close
set db=nothing
getCurrentBanners = current_banners
end function
%>
which works BUT as soon as i try and add a link in (<a href…) via an IF statement before hand to check it needs a link as per below.
if db("strLink") <> "" then
current_banners = current_banners & "<a href="""& db("strLink") &""">" & vbCrLf
end if
current_banners = current_banners & "<img alt=""" & db("strBannerAlt") &""" src=""/banners/uploads/" & db("flBannerImage") &""">" & vbCrLf
if db("strLink") <> "" then
current_banners = current_banners & "</a>" & vbCrLf
end if
i get the resulting code…
<li class="show">
<a href="website link"> ' does appear
<img alt="" src="[/banners/uploads/](http://www.kirupa.com/forum/view-source:http://webdev.west-cheshire.ac.uk/banners/uploads/)"> ' alt and source are both blank?
</a>
</li>