Hi all,...

i've created hyperlink from database to pdf file, my goals when i click the hyperlink then display the pdf file, but the problem is there is a transition page with broken image on the upper left corner and if i place the cursor around the icon the cursor change to hand icon and when i click again the pdf file appears.

so how to make the hyperlink from db direct to pdf file without a transition page/blank page ???

these is my script, previously i use this script for displaying image file (.png)

    $con = mysql_connect('localhost', 'test', '123');
    if (!$con)
    die('Could not connect: ' . mysql_error());
    mysql_select_db("dm", $con);
    //end of your conn.
    $query = mysql_query("SELECT file FROM 2012 WHERE id = '$q' LIMIT 1") or die(mysql_error());
    while($imglink = mysql_fetch_assoc($query))
    echo '<a href="'.$imglink['file'].'"><img src="'.$imglink['file'].'" width="430" height="608" alt="" /></a>';

if i use this script in hyperlink will appear :


and my hope the hyperlink will be direct to pdf file :


thank you

Recommended Answers

All 2 Replies

Member Avatar


and my hope the hyperlink will be direct to pdf file

You can try this way:

 //get file
 $imglink = $_GET["file"] .".pdf";
 //echo out file.pdf
 echo '<a href="'.$imglink.'">';

@sigit_p, you are getting the "broken link" icon because of the image element you have as content for the hyperlink: src="'.$imglink['file']. Based on your code, this is not a source for an image.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.