Why can't the last var_dump () print only one array?

Source: Internet
Author: User
The {code...} query contains multiple pieces of data!
    $orderQuery = "select sum(`goods`.goods_nums) goods_nums,goods.goods_id,goods.goods_array,goods.product_id,goods.goods_price     from iwebshop_order `order`     join iwebshop_order_goods `goods`     on `order`.id = `goods`.order_id     where `order`.status = '5'     and unix_timestamp(`order`.create_time)     between '".$begin."' and '".$end."'     group by `goods`.goods_id";    $njhl = new MYSQL("127.0.0.1","root","","test1");    $orderResult =  $njhl->query($orderQuery,'select');    if($orderResult)    {        foreach($orderResult as $item)        {            $goodsQuery = "select goods_no,huo_no from goods where id = ".$stock['goods_id'];            $goodsResult = $njhl->query($goodsQuery,'select');            if($goodsResult)            {                foreach($goodsResult as $goods)                {                    $goods_no = trim($goods['goods_no']);                    $goods_huo = trim($goods['huo_no']);                    $where;                    if($goods_no)                    {                        $goods_no = strlen($goods_no)<10?str_pad($goods_no, 10,'0',STR_PAD_LEFT):$goods_no;                        $where = "info.item_no = '".$goods_no."'";                    }                    else                    {                        $goods_huo = strlen($goods_huo)<5?str_pad($goods_huo, 5,'0',STR_PAD_LEFT):$goods_huo;                        $where = "info.item_huo = '".$goods_huo."'";                    }                    $stockQuery = "select * from info join stock on stock.item_no = info.item_no where ".$where;                    $hsh = new MYSQL("127.0.0.1","root","","test2");                    $stockResult = $hsh->query($stockQuery,'select');                    var_dump($stockResult);                }            }        }    }

The query contains multiple data records!

Reply content:
    $orderQuery = "select sum(`goods`.goods_nums) goods_nums,goods.goods_id,goods.goods_array,goods.product_id,goods.goods_price     from iwebshop_order `order`     join iwebshop_order_goods `goods`     on `order`.id = `goods`.order_id     where `order`.status = '5'     and unix_timestamp(`order`.create_time)     between '".$begin."' and '".$end."'     group by `goods`.goods_id";    $njhl = new MYSQL("127.0.0.1","root","","test1");    $orderResult =  $njhl->query($orderQuery,'select');    if($orderResult)    {        foreach($orderResult as $item)        {            $goodsQuery = "select goods_no,huo_no from goods where id = ".$stock['goods_id'];            $goodsResult = $njhl->query($goodsQuery,'select');            if($goodsResult)            {                foreach($goodsResult as $goods)                {                    $goods_no = trim($goods['goods_no']);                    $goods_huo = trim($goods['huo_no']);                    $where;                    if($goods_no)                    {                        $goods_no = strlen($goods_no)<10?str_pad($goods_no, 10,'0',STR_PAD_LEFT):$goods_no;                        $where = "info.item_no = '".$goods_no."'";                    }                    else                    {                        $goods_huo = strlen($goods_huo)<5?str_pad($goods_huo, 5,'0',STR_PAD_LEFT):$goods_huo;                        $where = "info.item_huo = '".$goods_huo."'";                    }                    $stockQuery = "select * from info join stock on stock.item_no = info.item_no where ".$where;                    $hsh = new MYSQL("127.0.0.1","root","","test2");                    $stockResult = $hsh->query($stockQuery,'select');                    var_dump($stockResult);                }            }        }    }

The query contains multiple data records!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.