簡體   English   中英

如何使用php從mysql db檢索pdf和doc文件

[英]How to retrieve pdf and doc files from mysql db using php

我試圖檢索已成功保存在mysql db中的pdf和doc文件,並允許用戶訪問它。但這就是我得到的userimages/1364700305.30527.pdf 檢索文件的代碼如下:

<?php
if (isset($_GET['svreg'])) {
    $svreg = $_GET['svreg'];
    $query = "
      SELECT image_file, note_title, note_commt
      FROM notez
      WHERE svreg = '$svreg'
    ";
    $result = mysql_query($query) or die('Error, query failed');
    list($image_file, $note_title, $note_commt) = mysql_fetch_array($result);
}
?>
<a href="veh_over_view.php?svreg=<?=$svreg;?>"><?=$image_file;?></a> <br> 

是的,我在數據庫中有完整路徑。

你沒有很好地解釋你想要什么,所以這就是我所知道的

    <?php
    if (isset($_GET['svreg'])) {

        $svreg = $_GET['svreg'];

        $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)){ ?>

             <a href="veh_over_view.php?svreg=<?=$svreg;?>"><?=$image_file;?></a> <br> 

    <?php }

    }?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM