mySQL and asp

Author Message
JenniG

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 7/11/2010
  • Status: offline
mySQL and asp Sunday, July 11, 2010 7:31 PM (permalink)
0
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;""> &laquo;" & objRS("name") & "</span>"
           
            If objRS("mailadresse") = "" Then
            Response.Write "&nbsp;"
            Else
            Response.Write "&nbsp; <a href=""mailto:" & objRS("mailadresse") & """><img border=""0"" src=""pictures/TagImg_mail.jpg"" alt=""E-mail""/></a>&nbsp;"
            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>
 
#1
    ehvbs

    • Total Posts : 3321
    • Scores: 110
    • Reward points : 0
    • Joined: 6/22/2005
    • Location: Germany
    • Status: offline
    Re:mySQL and asp Monday, July 12, 2010 12:20 AM (permalink)
    0
    you should replace "isn't working" with a detailed description of
    the error: what did you expect, what did happen, full text of the
    the error message, clear identification of the line (not only the number),
    and all the things I forgot.

    If the script doesn't write a nbsp though you know the "mailadresse"
    (sure of the spelling?) is empty, check how "empty" is specified in
    your DB (usual suspect: null). For testing you could write/log the
    data type (VarType, TypeName, Field type) of the relevant data.

     
    #2
      JenniG

      • Total Posts : 2
      • Scores: 0
      • Reward points : 0
      • Joined: 7/11/2010
      • Status: offline
      Re:mySQL and asp Monday, July 12, 2010 12:58 AM (permalink)
      0
      Thanks for the help.

      I've added this text:

      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 &nbsp;

      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.

       
      #3
        ehvbs

        • Total Posts : 3321
        • Scores: 110
        • Reward points : 0
        • Joined: 6/22/2005
        • Location: Germany
        • Status: offline
        Re:mySQL and asp Monday, July 12, 2010 2:01 AM (permalink)
        0
        I take this

           The page shows the image without the link.

        to mean: The concatenation

           "&nbsp; <a href=""mailto:" & objRS("mailadresse") & """><img bor ...

        does not produce a valid link. So check, what objRS("mailadresse")
        evaluates to (and pay attentention to types and encodings).

        Can't you use an independent tool to check the database content?

         
        #4
          cherylfoster

          • Total Posts : 2
          • Scores: 0
          • Reward points : 0
          • Joined: 1/10/2011
          • Status: offline
          Re:mySQL and asp Monday, January 10, 2011 12:18 PM (permalink)
          0
          VBScript (Visual Basic Scripting Edition) is an active scripting language developed by Microsoft, inspired by Visual Basic. It is designed as a &quot;lightweight&quot; language with an interpreter for quick use in a wide variety of Microsoft environments. VBScript uses the Component Object Model to access some parts of the environment where he works, for example, the File System Object (FSO) to create, read, update and delete files.
          <message edited by cherylfoster on Monday, January 10, 2011 12:28 PM>
           
          #5
            Hemadri

            • Total Posts : 1
            • Scores: 0
            • Reward points : 0
            • Joined: 1/31/2011
            • Status: offline
            Re:mySQL and asp Monday, January 31, 2011 11:14 PM (permalink)
            0
            Hi
             
            Thanks for sharing a nice information!!!
             
            Web development services
             
            #6

              Online Bookmarks Sharing: Share/Bookmark

              Jump to:

              Current active users

              There are 0 members and 1 guests.

              Icon Legend and Permission

              • New Messages
              • No New Messages
              • Hot Topic w/ New Messages
              • Hot Topic w/o New Messages
              • Locked w/ New Messages
              • Locked w/o New Messages
              • Read Message
              • Post New Thread
              • Reply to message
              • Post New Poll
              • Submit Vote
              • Post reward post
              • Delete my own posts
              • Delete my own threads
              • Rate post

              2000-2012 ASPPlayground.NET Forum Version 3.9