Hi all, i have a table in db which contain some pdf and docx files.
Am trying to display it in a way, so that when the user click on it, it will load the pdf and/or docx file from db in another/same window.

this is what i have done so far:

        $query = "SELECT image_file, note_title, note_commt FROM notez WHERE svreg = '".$svreg."'";
        $result = mysql_query($query) or die('Error, query failed');
        while(list($image_file, $note_title, $note_commt) = mysql_fetch_array($result))
        { ?>

        <img src="<?=$image_file?>" width='30' height='30' class='thumbnail' title='<?=$title?>'>                                                                      
        <?php } ?>

I would use pdf.js to load the pdf.

Not too sure about docx though.

thank for the code IIM, i tryed it

echo '<pre>';
//echo "starting\n";
                    set_time_limit (30); //to allow time for Word to load.
                    $word = new COM("word.application") or die ("Could not initialise MS Word object.");
                    echo "COM instantiated\n";
                    $word->Application->Visible = False; 
                    echo "set visibility to false\n";

                    $doc = "src='userimages_doc/1364905979.3535.doc'";
                    $document = reapath($doc);
                    //if (is_readable($document)
                    echo "Document exists and is readable \n";
                    echo "Document does not exist\n";die();
                    echo "Document is not readable\n"; die();
                    $word->Documents->Open( $document ); 
                    echo "Document opened\n";
                    // Extract content. 
                    $content = $word->ActiveDocument->Content; 
                    echo "test\n----------\n";
                    echo "test\n----------\n";
                    echo "Extracting string value of content\n";
                    $content = (string) $content;
                    echo "test\n----------\n";
                    echo $content;
                    echo "test\n----------\n";

                    echo $content; 

                    echo "Closed Document\n";
                    //echo "Quit Word \n"
                    $word = null; 


but i keep getting this error

Fatal error:  Call to undefined function reapath() in D:\xampp\htdocs\auto-habari\admin\userindex\vehicles\veh_over_view.php on line 441

i do not know if it have anything to do with this code

 $doc = "src='userimages_doc/1364905979.3535.doc'";

typo for realpath()

should test on the dir name only


thanks pzuurveen for the help, this is what i get

COM instantiated
set visibility to false
Document exists and is readable 
Document is not readable

can you pls tell me what it means, cos am not sure if the scprit is working

if (is_readable($document)) {
    echo "Document exists and is readable \n";
else {
    if(!is_file($document)) {
        echo "Document does not exist\n";
    else {
        echo "Document is not readable\n";