need help

Discussion in 'PHP' started by SnoozZz, Jun 25, 2008.

  1. #1
    I store my image names and url in a db, i use this script to display the image and link it to a url.

    $num_displayed = 1 ;
    $result = mysql_query ("SELECT * FROM details WHERE status='ok' ORDER BY RAND() LIMIT $num_displayed");
    while ($row = mysql_fetch_array($result))
    echo "<a href=\"".$row["url"] . "\"> <img src=\"".$row["image"]."\"> </a>" ;

    this all works fine

    my problem is that i display it in an Iframe . so I need the link to open in a new window.

    any ideas?
     
    SnoozZz, Jun 25, 2008 IP
  2. bokiatenxi

    bokiatenxi Peon

    Messages:
    27
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you could add the target attribute to the a tag, i.e. <a href=\"".$row["url"] . "\" target="_blank">
     
    bokiatenxi, Jun 25, 2008 IP
  3. SnoozZz

    SnoozZz Peon

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Nope didn't work,

    But this did,

    <head>
    <base target="_blank">
    </head>

    can't believe I didn't think of it before...

    thanx mate
     
    SnoozZz, Jun 25, 2008 IP