Skip to content

Tag: json

jQuery/Php Error Illegal string offset from unserialized post data

I’m posting a jquery serialize data posting from modal/pop up div tag with name attribute such as formdata[1]field_x The Fetch/XHR capture the serialized posted data, which indicate the posting is correct. The same result return with print_r($_POST[“formdata”] ); . formdata%5B1%5Dpayref_autonum=Yes&formdata%5B1%5Dpayref_prefix=P2022&formdata%5B1%5Dpayref_suffix=&formdata%5B1%5Dpayref_pad=4&formdata%5B1%5Dpayref_next=876&formdata%5B1%5Dpayref_sample= The data are getting un-serialized parse_str($_POST[“formdata”], $formdata );. However $formdata return an empty array. Answer The issue is your form

REST Server-Client Communication

I’m developing an Android app in Java and I need to add a REST Server-Client Communication feature to it. I assume that the following code should post data to a .php file and will be thankful if someone explains to me what does it do and how to use it properly: Answer My answer is in as comments in your

Get empty result api firebase [FCM]

I’ve saved some of my mobile registration_codes that are connected with my development environment of Firebase. Once I send a manual notification by the api I receive empty feedback from Firebase himself. After debugging I found that the notification has not been send. What’s wrong with my call, because the call I make is the same in the examples and

How can I fetch results from a junction table and insert them as an array into a JSON object using PHP?

I have Articles with Categories in a mysql Database. I would like to print out all Articles with their corresponding Categories as JSON in PHP to fetch with my Vue-App. I’m working with the following tables: Articles, Categories and Article_has_Category (junction table, many to many): The following PHP-Code selects and prints all Articles for my Frontend to fetch: Is it

How to sum up property string length by ID using PHP in a JSON array

I am trying to sum up the character count(total string length) of all the characters contained in the various “info” properties by “user_id”. I am trying to have a situation where USER-ID A001 has 300 total characters in INFO I am hoping someone can point me in the right direction. Below is my code snippet: MY PHP Answer Use an

SQL query JSON of MySQL 8.0 comes String instead of Array

I create a table in MySQL 8.0 as follows: It contains JSON type data, and I insert some data as: And I use php to visit the database, I wish to get value of “airline” as an Array. But it comes out a String, NOT an Array! This really annoys me, and JSON in MySQL is hard to understand. Answer

Getting rid of numbers in a json response ( LARAVEL 9 )

i’m having some problems with my json response. When I make an api call from a user (id:1) it returns the response well, but if i change the user (f.e id:2) it returns it with some identifiers on it. Any idea? Response from id:1 Response from id:2 Thanks! EDIT 1 This is how I am getting the response: Answer Right

Retrieve data from the name of a directory in my database

I use php and laravel. I have a column named MsgBody. In this column, there is an array as follows. I want to get the value of “conversationDesc” from this array. What should I do in the Controller and blade part for this? Answer It seems that your data are JSON. You can decode this using json_decode. You should be