簡體   English   中英

使用 myphpadmin 的圖像未知

[英]Image unkown with myphpadmin

嘗試使用數據庫來引用和圖像位置時,它顯示為空白

     <td><img width="100" height="100" src=<?php echo $item[image]; ?></td>

表中的其他字段工作正常,如名稱和價格,圖像返回圖像未知錯誤。 我將如何 go 關於在 myphpadmin 中引用圖像位置?

        echo count($_SESSION['cart']); ?> items.</p>
    <p><a href="?cart">View your cart</a></p>
    <table border="1">
      <thead>
        <tr>
          <th>Item Description</th>
          <th>Price</th>
    <th>image</th>
     
        </tr>
      </thead>
      <tbody>
        <?php foreach ($items as $item): ?>
          <tr>
            <td><?php htmlout($item['desc']); ?></td>
            <td>
              $<?php echo number_format($item['price'], 2); ?>
            </td>
      <td>
    <img width="100" height="100" src=<?php echo $item[image]; ?>
            </td>
              <form action="" method="post">
                <div>
                  <input type="hidden" name="id" value="<?php
                      htmlout($item['id']); ?>">
                  <input type="submit" name="action" value="Buy">
                </div>
              </form>
            </td>
          </tr>
        <?php endforeach; ?>
      </tbody>
    </table>    
         

以下是項目包含的內容:

$items = array();

$query = "SELECT * FROM catalog";
$result = $conn->query($query);
while($row = $result->fetch_assoc())
 {
 $item = array('id' => $row['Item_id'], 'desc' => $row['description'], 'price' => $row['price'], 'image' => $row[image]);
 $items[] = $item;
 } 

它應該是:

  src="<?php echo $item['image']?>"

暫無
暫無

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

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