SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Jul 2003
    Location
    england
    Posts
    822
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question Create Link from Text from DB

    OK. I'll try not to make this complex. I have a DB:

    se_id auto
    date varchar
    description varchar
    time varchar
    link varchar

    When my web page lists the date, description and time, I would like the description be a link if there is something under the 'link' field (i.e, papasmurf.php) that would link to that page.

    Any solutions?

    Thank you in advance,
    Toad78

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, if that's just about it, then you would just need to do something like:

    PHP Code:
    if($row['link'])
    {
       
    $row['description'] = "<a href='{$row['link']}'>{$row['description']}</a>";

    Assuming a variable called $row holds the database query results.

  3. #3
    SitePoint Guru
    Join Date
    Jul 2003
    Location
    england
    Posts
    822
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chris_fuel View Post
    Well, if that's just about it, then you would just need to do something like:

    PHP Code:
    if($row['link'])
    {
       
    $row['description'] = "<a href='{$row['link']}'>{$row['description']}</a>";

    Assuming a variable called $row holds the database query results.
    It worked! Thank you!


Bookmarks

Posting Permissions

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