Hyperlinks with Coldfusion code

Discussion in 'Programming' started by lespaul00, Dec 9, 2007.

  1. #1
    Hello,

    I have the following code:

    <cfquery datasource="mydatabase" name="source">
          SELECT SOURCE
          FROM TABLE
    </cfquery>
    
    <cfoutput query="source">
    <p><em><a href="#source.SOURCE#">Source</a></em></p>
    </cfoutput>
    Code (markup):
    In the SOURCE field of my database, there's a web address (http://www.address.com). My problem is, when I click on it, it tries to find this website from within my website's directory... (http://www.mywebsite.com/http://www.address.com), which, is obviously incorrect. How can I have it avoid this?

    Thanks.
     
    lespaul00, Dec 9, 2007 IP
  2. unitedlocalbands

    unitedlocalbands Well-Known Member

    Messages:
    246
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    128
    #2
    I took a look at my old Ms Access database to see what datatype I used.

    In the url column I set the datatype to hyperlink,

    I'm cant remember if I ran into this same problem back then or not, but check to see if yours is set to hyper link or not.
     
    unitedlocalbands, Dec 9, 2007 IP
  3. lespaul00

    lespaul00 Peon

    Messages:
    283
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I checked the data type. It's currently "hyperlink". I think by the nature of my code (that I attribute the text as a hyperlink already) that if I change it in my database to TEXT or MEMO, it should work.

    Thanks
     
    lespaul00, Dec 9, 2007 IP