how to put a link into database

Discussion in 'MySQL' started by dougvcd, Jul 9, 2007.

  1. #1
    can any one tell me how to put a link to a web site in to a field in a database
    i copied and pasted one but it wasnt active
    cheers
    Doug
     
    dougvcd, Jul 9, 2007 IP
  2. alemcherry

    alemcherry Guest

    Best Answers:
    0
    #2
    hehe.. do you understnad sql queries or atleast phpMyAdmin? Instead of giving a one word answer, I recommend you to pick up some sql basics, mysql administration though phpMyAdmin and basics about php/mysql interface. Without that you may not be able to do much.

    Putting something into a field using phpMyAdmin is plain simple. But diagnosting your problem is not!
     
    alemcherry, Jul 9, 2007 IP
  3. qazu

    qazu Well-Known Member

    Messages:
    1,834
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    165
    #3
    Most databases do not support hyperlinks. It's just not a datatype. You can only enter it as nchar, nvarchar, text, etc.

    If you want to take a url from the database to a webpage and have it active you need to enclose the data in the correct tags, or you can include the tags in the database so instead of using http://www.domain.com in the databse, use <a href="http://www.domain.com" >Anchor Text</a>

    Hope that helps
     
    qazu, Jul 9, 2007 IP
  4. dougvcd

    dougvcd Peon

    Messages:
    267
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    but can this be done
    cheers
    Doug
     
    dougvcd, Jul 9, 2007 IP
  5. falcondriver

    falcondriver Well-Known Member

    Messages:
    963
    Likes Received:
    47
    Best Answers:
    0
    Trophy Points:
    145
    #5
    falcondriver, Jul 9, 2007 IP
  6. dougvcd

    dougvcd Peon

    Messages:
    267
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    thanks Gazo
    that works just fine
    and thanks to all for info
    cheers
    Doug
     
    dougvcd, Jul 9, 2007 IP
  7. N_F_S

    N_F_S Active Member

    Messages:
    2,475
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    90
    #7
    You can also use http://www.domain.com in the database

    And in fact it will take less space, then output it like


    <a href="<here goes the variable from DB>" >Anchor Text</a>

    Depends on what you need to achieve, if the field is only for links, then this method is better, if it's mixed with text - then use gazu's method.
     
    N_F_S, Jul 9, 2007 IP