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.

PHP, MYSQL, diplay the pdf file contents,

Discussion in 'PHP' started by tldmic, Sep 5, 2010.

  1. #1
    I have an issuer here, am busy designing my own website and I want my members to read the articles that I will be posting, so I have already designed mysql DB,
    Hence, I am able to retrieve the information from the data base when saving the file into folder, now I want to display the file, at the moment, I can display the file contents and no luck for the file itself.
    here is the code:

    //Retrieves data from MySQL
    $data = mysql_query("SELECT * FROM upload_articles WHERE hid=13") or die(mysql_error());
    $row = mysql_fetch_array( $data );
    $catid= $row['hid'];
    if($catid==0)
    {
    echo "No pdf file";
    }
    else
    {
    //Outputs the file and other data
    $List = $row['file_name'];
    echo "File name = ".$List;
    echo "<p>File size = ".$row['size'];
    echo "<p>Uploaded date = ".$row['upload_date'];
    echo "<p>Title = ".$row['title'];
    echo "<p>hid = ".$row['hid']."<p>";

    //open the file in the folder
    //$pdf = pdf_new();
    pdf_open_file("articles/".$info['file_name'] ."");
    }

    Your help if of great importance to me
    many thanks
    tldmic
     
    tldmic, Sep 5, 2010 IP
  2. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #2
    Are you trying to display the PDF file as HTML? Sorry, but I don't think that's possible. All you will probably see are garbage characters.

    You can use Google Doc Viewer instead to make your life easier. Just pass the link to the PDF file to it
     
    Rainulf, Sep 5, 2010 IP