2016-11-19 48 views
0

我試圖將數據插入到MySQL,我在下面獲取數據formate.Could有人幫助我如何讀取第二陣列數據多個磁盤陣列,請閱讀使用PHP

stdClass Object 
(
    [name] => pradeep 
    [email] => [email protected] 
    [message] => Address 
    [PHONE] => 052121569 
    [tst] => Array 
     (
      [0] => stdClass Object 
       (
        [UID] => 1005 
        [NAME] => coconut-medium 
        [QTY_TYP] => KG 
        [RATE] => 5.00 
        [IMG_ID] => coconutmedium.JPG 
        [status] => 1 
        [TYPE] => V 
        [INT_WT] => 1 
        [DIS] => 0 
        [init] => 1 
        [selQnty] => 1 
        [actualRate] => 5.00 
        [showDel] => 1 
       ) 

      [1] => stdClass Object 
       (
        [UID] => 1006 
        [NAME] => Colocasia 
        [QTY_TYP] => Grms 
        [RATE] => 11.00 
        [IMG_ID] => Colocasia.jpg 
        [status] => 1 
        [TYPE] => V 
        [INT_WT] => 250 
        [DIS] => 0 
        [init] => 250 
        [selQnty] => 250 
        [actualRate] => 11.00 
        [showDel] => 1 
       ) 
     ) 
) 

我能讀取第一個數組數據,echo "Name : ".$data->name."\n";如何準備好第二個數組中的UID。

+0

哪一個是'第二陣列data'? – urfusion

+0

第二個是'object',而不是'array' –

+2

嘗試'$ data-> tst [0] - > UID'。讓我知道它是否工作。 – urfusion

回答

1

嘗試此下面:

echo ("First UID is: ".$data->tst[0]->UID);