图片显示电子商务网站的断开链接

时间:2016-10-01 23:18:16

标签: php

图像显示断开的链接。我的图片没有显示。只显示一个方框代替它。

function getPro(){

if(!isset($_GET['cat'])) {
          if(!isset($_GET['brand'])) {
global $con; 

$get_pro = "select * from products order by RAND() LIMIT 0,6";

$run_pro = mysqli_query($con, $get_pro); 

while($row_pro= mysqli_fetch_array($run_pro)){
    $pro_id = $row_pro['product_id'];
    $pro_cat = $row_pro['product_cat'];
    $pro_brand = $row_pro['product_brand'];
    $pro_title = $row_pro['product_title'];
    $pro_price = $row_pro['product_price'];
    $pro_image = $row_pro['product_image'];

    echo "
            <div id='single_product'>

                <h3>$pro_title</h3>

                <img src='admin_area/product_images/$pro_image' width='180' height='180' />

                <p><b> Price: $ $pro_price </b></p>

                <a href='details.php?pro_id=$pro_id' style='float:left;'>Details</a>

                <a href='index.php?add_cart=$pro_id'><button style='float:right'>Add to Cart</button></a>

             </div>
    ";
    }
    }
}
}

1 个答案:

答案 0 :(得分:0)

你似乎在构造输出字符串时犯了一个概念错误:

  • $val = "Hello World"; echo $val;将输出“Hello World”
  • $val = "Hello World"; echo "$val";将输出“$ val”

尝试这样的事情

echo "<div id='single_product'>
            <h3>" . $pro_title . "</h3>
            <img src='admin_area/product_images/" . $pro_image . "' width='180'
            [...]"