doufan9805 2016-05-06 15:45
浏览 26

使用php检索数据库图像

I am trying to retrieve images from my database, everything else works and is retrieved ok from the database except the images, does anyone have any idea what im doing wrong? the code im using is shown below:

  $query = "SELECT p.name, p.image, p.price, p.description, p.category_id, ci.quantity   
    FROM products p 
        LEFT JOIN cart_items ci 
            ON p.id=ci.product_id 
    WHERE p.id=? 
    LIMIT 0,1";

 $stmt = $con->prepare( $query );
 $stmt->bindParam(1, $id);
 $stmt->execute();

 $row = $stmt->fetch(PDO::FETCH_ASSOC);

 $name = $row['name'];
 $image = $row['image'];
 $price = $row['price'];
 $description = $row['description'];
 $category_id = $row['category_id'];
 $quantity = $row['quantity'];
  ?>
 <!-- HTML form for updating a product -->
<table class='table table-hover table-responsive table-bordered' style='margin:1em 0 0 0;'>

<tr>
    <td style='width:30%;'>Name<?php echo "<div class='product-id' style='display:none;'>{$id}</div>"; ?></td>
    <td class='product-name' style='width:70%;'><?php echo $name; ?></td>
</tr>

  <tr>
    <td>Image</td>
    <td><?php echo '<img src=""images/'.$image.'" />'; ?></td>
</tr>

It currently shows a blank box when this is in the web browser, it doesnt seem to be finding the images which are in a folder called images

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算