douzuqin3467 2015-03-13 15:50
浏览 42

如何在while循环中将数组中的值添加到文本框中

I have products on a loop in a shopping cart, but the values of qty is not appearing it have this error on every textbox.
Notice: Array to string conversion in C:\xampp\htdocs\ecommerce\cart.php on line 172
Array

<?php 
    $total = 0;

    global $con; 

    $ip = getIp(); 

    $sel_price = "select * from cart where ip_add='$ip'";

    $run_price = mysqli_query($con, $sel_price); 

    while($p_price=mysqli_fetch_array($run_price)){

        $pro_id = $p_price['p_id']; 

        $pro_price = "select * from products where product_id='$pro_id'";

        $run_pro_price = mysqli_query($con,$pro_price); 

        while ($pp_price = mysqli_fetch_array($run_pro_price)){

        $product_price = array($pp_price['product_price']);

        $product_title = $pp_price['product_title'];

        $product_image = $pp_price['product_image']; 

        $single_price = $pp_price['product_price'];
        $single_price = number_format($single_price);
        $values = array_sum($product_price); 
        $total += $values;  


        $pro_qty = "select * from cart where p_id='$pro_id'";

        $run_pro_qty = mysqli_query($con,$pro_qty); 

        while ($pp_qty = mysqli_fetch_array($run_pro_qty)){

        $product_qty = array($pp_qty['qty']);

                ?>

                <tr align="center">
                    <td><input type="checkbox" name="remove[]" value="<?php echo $pro_id;?>"/></td>
                    <td><?php echo $product_title; ?><br>
                    <img src="admin_area/product_images/<?php echo $product_image;?>" width="60" height="60"/>
                    </td>
                    <td><input type="text" size="4" name="qty" value="<?php echo $product_qty;?>"/></td>
                    <td><?php echo "Php " . $single_price; ?></td>
                </tr>
    <?php } }?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 给自己本科IT专业毕业的妹m找个实习工作
    • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
    • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
    • ¥50 mac mini外接显示器 画质字体模糊
    • ¥15 TLS1.2协议通信解密
    • ¥40 图书信息管理系统程序编写
    • ¥20 Qcustomplot缩小曲线形状问题
    • ¥15 企业资源规划ERP沙盘模拟
    • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
    • ¥15 前端echarts坐标轴问题