0

I am trying to insert data to Mysql, I am getting data in below formate.Could some one help me how to read second array data

stdClass Object
(
    [name] => pradeep
    [email] => nd.naa@ga.com
    [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
                )
        )
)

I am able to read first array data,echo "Name : ".$data->name."\n"; how to ready UID which is int he second array.

urfusion
  • 5,528
  • 5
  • 50
  • 87
Pradeep
  • 11

1 Answers1

1

Try this below:

echo ("First UID is: ".$data->tst[0]->UID);
Pham Lai
  • 151
  • 1
  • 7