i have this type of data store in mysql, how can i echo only the amount value from this?
{"1":{"amount":"700","date":"2022-10-31","amount_discount":"0","amount_fine":"0","description":"","collected_by":"John Doe","payment_mode":"Cash","received_by":"12","inv_no":1},"2":{"amount":"300","date":"2022-12-17","description":" Paid by: Jane Doe","amount_discount":0,"amount_fine":"0","payment_mode":"upi","received_by":"23","inv_no":2}}
this code looks like json data, if yes then should i be using jquery to echo the values or is there a way to do it in php?
2
Answers
You can use the json_decode function to turn it into a PHP object and then access its properties. For your example, you can do this to get the "amount" property: