1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How can i do this?

Discussion in 'PHP' started by swiftmed, Feb 4, 2007.

Thread Status:
Not open for further replies.
  1. #1
    Hey guys,

    on my website there is a page which pulls some articles from a database, and on that page it displays things like the article, author name, author link etc. the thing is right now the page displays the authors link like www.swiftmediauk.co.uk but we want it to say "View Website".

    This is the code that pulls that link:

    if($row['link . $i'] != null)
                    {
                        echo("<a href=\"http://" . $row['link$i'] . "\">" . $row['link$i'] . "</a><br />");
                    }
    Code (markup):
    Can anybody tell me what that line should read to make the link appear as View Website please?
     
    swiftmed, Feb 4, 2007 IP
  2. trevlar

    trevlar Peon

    Messages:
    65
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if($row['link . $i'] != null)
                    {
                        echo("<a href=\"http://" . $row['link$i'] . "\">View Website!</a><br />");
                    }
    PHP:
     
    trevlar, Feb 4, 2007 IP
  3. swiftmed

    swiftmed Peon

    Messages:
    1,070
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hello mate,

    thanks for doing that, it worked a treat. thanks for taking the time to help me.
     
    swiftmed, Feb 4, 2007 IP
  4. swiftmed

    swiftmed Peon

    Messages:
    1,070
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ive just looked at the articles page again and clicked on the "view website" link and for some reason the web address seems to be wrong on all. The url showing is "http:///"... any ideas mate?
     
    swiftmed, Feb 4, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    $row['link$i']

    The variable $i is between single quotes and won't be parsed. So you're basically trying to echo an undefinied variable. Use double quotes instead.
     
    nico_swd, Feb 4, 2007 IP
Thread Status:
Not open for further replies.