2013-10-10 60 views
0

我正在基本的電子商務項目,我試圖顯示圖像使用文件路徑名稱從MySQL和存儲圖像文件的文件夾名稱「圖像」。顯示圖像文件路徑的麻煩

我用這個代碼來顯示圖像,但不工作,只是沒有顯示的圖片請查看示例代碼...

/// Gather these full product Information from database /// ////// 

if (isset($_GET['pid'])) { 
    $targetID = $_GET['pid']; 
    $sql = mysql_query("SELECT * FROM product WHERE product_id='$targetID' LIMIT 1"); 
    $productCount = mysql_num_rows($sql); // count the output amount 
    if ($productCount > 0) { 
     while ($row = mysql_fetch_array($sql)) { 
      $product_id = $row["product_id"]; 
     $product_name = $row["product_name"]; 
     $product_detail = $row["product_detail"]; 
     $product_company = $row["product_company"]; 
     $screenshot = $row["screenshot"]; 
     } 
    } else { 
     echo "Sorry dude that crap dont exist."; 
     exit(); 
    } 
} 
?> 

部分的這種形式,我使用.... (請看最後一行回顯的那一行...)

<form id="form1" name="form1" method="post" action="edit_company.php"> 
    <table width="95%" border="1" align="center"> 
    <tr> 

    echo '<td width="36%" rowspan="9" align="right"> <img src="' . GW_UPLOADPATH . $screenshot .'" width="351" height="402" /> </td>'; 

但是最後一行沒有顯示圖像,我錯過了什麼!

+0

試,寬度= 「351」 HEIGHT = 「402」/> –

+0

定義( 'GW_UPLOADPATH','image /'); –

+0

<?php echo''; ?> – Ashish

回答

0

嘗試此

<img src="<?php echo $GW_UPLOADPATH . $screenshot ?>" width="351" height="402" />