Json data to MySQL using PHP -
I'm new to Jason and PHP this is sample, but I keep using PHP using PHP With this code, I can not input the JSON data to JSN Data as "JSON data" and input the JSON Data Input ["@Contact": "DFG2"]. MySQL, like "Empid": "M01AH"], ["name": "Ricky Jones"], could put these values in MySQL using PHP,
The question is how can Are I using ["@context": "dfg2"] using PHP in MYSQL? I know that it is not good to use @ in PHP scripts.
$ json_obj = '{"empid": "mhh", "personal": {"name" : "Ricky Jones", "Gender": "Male"}, "Profile": {"Designation": "VP", "Department": "Marketing", "@context": "dfg2"}} '; // If I put ["@context" in: "dfg2"] I can put data in MYSQL / data / convert to stdclass object $ emp_data = json_decode ($ json_obj); Store Element Value in // variable $ id = $ emp_data- & gt; Empid; $ Name = $ emp_data- & gt; Individual- & gt; Name; $ Gender = $ emp_data- & gt; Individual- & gt; Gender; $ Designation = $ emp_data- & gt; Profile-> Designation; $ Section = $ emp_data- & gt; Profile-> Department; $ E = $ emp_data- & gt; Profile-> @context; // If I take it out, then I can put data in MYSQL. How can I leave data to mysql / mysql databasea ??? One ???? Enter value in the $ Sql = "tbl_employee (` empid`, `empname`,` gender`, `designation`,` department`, `@ reference`) (value '$ id', '$ name', '$ Gender ',' $ designation ',' $ department ',' $ e ') "; In my SQL I was able to enter empid , empname , gender , < Please help me by using the @ Icon in code <@>
, php and mysql Please.
You need to avoid property names like this:
$ e = $ Emp_data-> Profile- & gt; {'Reference'};
Comments
Post a Comment