Eduardo Fuerte
asked on
Could you point what is wrong with this .json structure?
Hi Experts
Could you point what is wrong with this .json structure?
films.txt
(Please rename it to films.json)
In a manner it couldn't be saved in a .php file, accordingly to:
Thanks in advance!
Could you point what is wrong with this .json structure?
films.txt
(Please rename it to films.json)
In a manner it couldn't be saved in a .php file, accordingly to:
Thanks in advance!
if you want to use an external file (without the jsonstring but only the json WITHOUT the single quotes at beg and end :
$json = file_get_contents("films.j son"); // films.json is the file your original file (films.txt)
http://php.net/manual/fr/function.file-get-contents.php
please note file-get-contents return a string
$json = file_get_contents("films.j
http://php.net/manual/fr/function.file-get-contents.php
please note file-get-contents return a string
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@leakim971
Thank you for help!
My next chalenge is to update a MySQL DB - I have no Mongo's DB experience.
Thank you for help!
My next chalenge is to update a MySQL DB - I have no Mongo's DB experience.
check this page and the first comment describing how to connect and insert from a json object :
http://php.net/manual/fr/class.mongodb.php#101972
unlike mysql mongo don't care about about table structure (columns), you can store anything :
https://www.mongodb.com/scale/what-is-a-non-relational-database
this an advantage and an inconvenient
but if you need to store JSON objects, it's one of the best
http://php.net/manual/fr/class.mongodb.php#101972
unlike mysql mongo don't care about about table structure (columns), you can store anything :
https://www.mongodb.com/scale/what-is-a-non-relational-database
this an advantage and an inconvenient
but if you need to store JSON objects, it's one of the best
ASKER
I'm afraid I don't have time now to start with MongDB just now...
ASKER
@leakim971
Could you check this new question too?
https://www.experts-exchange.com/questions/29076910/How-to-search-in-this-multidimensional-array-by-using-PHP.html
Could you check this new question too?
https://www.experts-exchange.com/questions/29076910/How-to-search-in-this-multidimensional-array-by-using-PHP.html
$ar = json_decode($jsonstring); // please note I escaped all single quotes ( ' become \' ) in the string
Open in new window
http://php.net/manual/fr/function.json-decode.php