Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder googleit's Avatar
    Join Date
    Jul 2006
    Location
    birmingham, uk
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how do you do this?

    how do you get plain text from a mysql db an turn them into hyperlinks? here is the code i have so far
    PHP Code:
    <?php 
    mysql_connect
    ("host","username","pass"); 
    mysql_select_db("dbname"); 
    $query "SELECT data,site FROM site  where id=$id"
    $result MYSQL_QUERY($query); 
    $data MYSQL_RESULT($result,0,"data"); 
    print 
    $data
    ?>
    any help would be great

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    you echo the html, and then the browser interprets it:
    PHP Code:
    $variable='http://www.example.com';
    echo 
    '<a href="'.$variable.'">Link Text</a>'
    mysql plays no relevant part.

  • #3
    Regular Coder googleit's Avatar
    Join Date
    Jul 2006
    Location
    birmingham, uk
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok thanks ill try your code

  • #4
    Regular Coder
    Join Date
    Aug 2006
    Location
    UK, London, Dartford
    Posts
    221
    Thanks
    3
    Thanked 14 Times in 14 Posts
    But if you wanted to to do a random site link eveytime just use a DB to store it all then just select the description and link.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •