while循环的非法字符串偏移量

时间:2015-06-08 12:08:15

标签: php

<?php
include 'inc/connect.php';

if ($_GET['id'] )
        {
            $p_id = $_GET["id"];
            $query = "SELECT * FROM products WHERE p_id= '$p_id'";
            //var_dump($query);
            $resu = mysqli_query($con, $query);
                while($rs = mysqli_fetch_assoc($resu))
            { 
              ?> <img src="<?php echo $p_id['p_image']; ?>" alt="" /> <?php 
              //var_dump($query);                               
            }
        }

?>

这是我的代码,这显示我的浏览器错误我该怎么办..? 图像无法加载

1 个答案:

答案 0 :(得分:5)

替换此

<img src="<?php echo $rs['p_image']; ?>" alt="" />

<img src="<?php echo $p_id['p_image']; ?>" alt="" />