php help needed

Ikigai

Active member
Jan 28, 2021
243
71
28
34
India
what is the PHP code to get values from this

[{"id":17,"inv_no":"117","order_id":"15","qty":5,"variant_id":5,"vender_id":8,"price":10000,"discount":1000,"tax_amount":"9000","shipping":"0","handlingcharge":5,"status":"delivered","local_pick":null,"loc_deliv_date":null,"created_at":"2021-05-30T13:16:31.000000Z","updated_at":"2021-05-31T10:52:26.000000Z","paid_to_seller":"NO","igst":1098,"sgst":null,"cgst":null,"deleted_at":null,"tracking_id":"8YIFNSCHZ4","gift_charge":0}]


I want to get inv_no, created_at , tracking_id

somebody help
 

NullMaster

Well-known member
Null Master
Trusted Uploader
Jul 25, 2018
12,062
22,063
120
array (
'id' => 17,
'inv_no' => '117',
'order_id' => '15',
'qty' => 5,
'variant_id' => 5,
'vender_id' => 8,
'price' => 10000,
'discount' => 1000,
'tax_amount' => '9000',
'shipping' => '0',
'handlingcharge' => 5,
'status' => 'delivered',
'local_pick' => NULL,
'loc_deliv_date' => NULL,
'created_at' => '2021-05-30T13:16:31.000000Z',
'updated_at' => '2021-05-31T10:52:26.000000Z',
'paid_to_seller' => 'NO',
'igst' => 1098,
'sgst' => NULL,
'cgst' => NULL,
'deleted_at' => NULL,
'tracking_id' => '8YIFNSCHZ4',
'gift_charge' => 0,
);
 
  • Like
Reactions: freenulled

Ikigai

Active member
Jan 28, 2021
243
71
28
34
India
bro this is the complete file ....... it is actually from emart application's order page
 

Ikigai

Active member
Jan 28, 2021
243
71
28
34
India
when i echo $x ... i got this
[{"id":17,"inv_no":"117","order_id":"15","qty":5,"variant_id":5,"vender_id":8,"price":10000,"discount":1000,"tax_amount":"9000","shipping":"0","handlingcharge":5,"status":"delivered","local_pick":null,"loc_deliv_date":null,"created_at":"2021-05-30T13:16:31.000000Z","updated_at":"2021-05-31T10:52:26.000000Z","paid_to_seller":"NO","igst":1098,"sgst":null,"cgst":null,"deleted_at":null,"tracking_id":"8YIFNSCHZ4","gift_charge":0}]
 

Ikigai

Active member
Jan 28, 2021
243
71
28
34
India
i try but i cant upload any file ... and not even a script .. why this happens.. im getting this error

threads/php-help-needed.47930/add-reply:1 Failed to load resource: the server responded with a status of 403 ()
 

l4zyh4x0r

Member
Jul 11, 2020
75
36
18
what is the PHP code to get values from this
PHP:
$json_data = '[{"id":17,"inv_no":"117","order_id":"15","qty":5,"variant_id":5,"vender_id":8,"price":10000,"discount":1000,"tax_amount":"9000","shipping":"0","handlingcharge":5,"status":"delivered","local_pick":null,"loc_deliv_date":null,"created_at":"2021-05-30T13:16:31.000000Z","updated_at":"2021-05-31T10:52:26.000000Z","paid_to_seller":"NO","igst":1098,"sgst":null,"cgst":null,"deleted_at":null,"tracking_id":"8YIFNSCHZ4","gift_charge":0}]';
$obj = json_decode($json_data)[0];

echo "inv_no: ".$obj->inv_no."<br/>";
echo "created_at: ".$obj->created_at."<br/>";
echo "tracking_id: ".$obj->tracking_id."<br/>";
 
  • Like
Reactions: frizzel and Ikigai

Ikigai

Active member
Jan 28, 2021
243
71
28
34
India
PHP:
$json_data = '[{"id":17,"inv_no":"117","order_id":"15","qty":5,"variant_id":5,"vender_id":8,"price":10000,"discount":1000,"tax_amount":"9000","shipping":"0","handlingcharge":5,"status":"delivered","local_pick":null,"loc_deliv_date":null,"created_at":"2021-05-30T13:16:31.000000Z","updated_at":"2021-05-31T10:52:26.000000Z","paid_to_seller":"NO","igst":1098,"sgst":null,"cgst":null,"deleted_at":null,"tracking_id":"8YIFNSCHZ4","gift_charge":0}]';
$obj = json_decode($json_data)[0];

echo "inv_no: ".$obj->inv_no."<br/>";
echo "created_at: ".$obj->created_at."<br/>";
echo "tracking_id: ".$obj->tracking_id."<br/>";
thanks bro :)
 

l4zyh4x0r

Member
Jul 11, 2020
75
36
18
For index.blade.php:
PHP:
echo "inv_no: ".$value->inv_no."<br/>";
echo "created_at: ".$value->created_at."<br/>";
echo "tracking_id: ".$value->tracking_id."<br/>";

Corrected.
 
Last edited:

Ikigai

Active member
Jan 28, 2021
243
71
28
34
India
i uploaded two images...
table.jpeg- this is the seller's order page .... it only have few columns but, i want to show inv no, cgst, sgst, igst, shipping, handing charger, gift charger etc..
 

Ikigai

Active member
Jan 28, 2021
243
71
28
34
India
but when a customer purchase morethan one item... it only show cgst sgst of first item only.... i this that foreach only once .... how to get all data?
 

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu