I've created a guest-book for my website, and I don't know how to solve this problem.
The problem is that my IF-statement retrieving mail addresses, isn't working.
If the DB isn't empty, I'd like the mail-address to be a "mailto" link on an image.
If it's empty it should overwrite the image and link with a simple
If nothings is submitted by the visitor typing on my guest-book the field in my mySQL DB aren't NULL, just empty.
The name ("mailadresse") is spelled correct.
The page shows the image without the link.
What am I doing wrong?
I've checked names so everything should be good to go.
The source code:
Dim objConn
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString="'commented out, but it works just fine'"
objConn.Open
strSQL = "SELECT * FROM guestbook ORDER By ID desc"
Set objRS = objConn.Execute(strSQL)
IF objRS.EOF Then
Response.write "<p><i>No messages</i></p>"
Else
Do
Response.Write "<p><b style=""font-size:9px; color:#999999;"">Dato: " & objRS("date") & "</b><br />"
Response.Write "<span style=""font-size:12px; font-weight:bold; color:#79dc00;""> «" & objRS("name") & "</span>"
If objRS("mailadresse") = "" Then
Response.Write " "
Else
Response.Write " <a href=""mailto:" & objRS("mailadresse") & """><img border=""0"" src=""pictures/TagImg_mail.jpg"" alt=""E-mail""/></a> "
End if
Response.Write "<b style=""color:#79dc00;"">" & objRS("subject") & "</b>"
Response.Write "<br />" & objRS("message") & "<br /><br />"
Response.Write "<img src=""pictures/SkilleStreg.jpg""/></p>"
objRS.MoveNext
Loop While Not objRS.EOF
End If
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
I hope someone can help me out here! =)
<message edited by JenniG on Monday, July 12, 2010 12:56 AM>