Skip to content

Tag: json

Populating mysql table with json data in phpmyadmin

I have the following example json file and I’m trying to populate a MySQL table with it. Populating books table with json data did not work and with no errors. I want to know what is wrong in the following PHP code: json file looks like this: Mysql table structure looks like this: Table structure Answer…

How do I output in proper JSON format in PHP?

I want to output some records from mysql table with resCode and resText in JSON in the following way: Since I’m very new to PHP arrays, I’m unable to format the server side part to output like above. Also I don’t know how to output the resCode and resText. Any help for the same will be appre…

Sort json array by value using PHP

I am trying to sort the array using usort().But my function does not seem to work. I want to sort it by partners_order of each object i.e, $myJson[0] and then $myJson1 separately The Json array is decoded using $myJson = json_decode($jsonData); PHP function to sort is written below. Due to restrictions in thi…

convert large data in json format

i have a table named mobile in which all the mobile data is contained which have more then 7000 records now i want to display in json format but some how records are not showing here is my code kindly check .. table Answer The problem with JSON_ENCODE in PHP is, it tends to add double quotes and escaping sequ…

how to force space to %20 in http_build_query?

I am facing a problem, that the API endpoint expects one of parameters with %20 replacing one of the spaces. Example: If I write ‘scope’ => ‘api offline_access’ the space gets translated to + sign when passing it to http_build_query() function. If I keep it like it is above, the sig…