Jump to content

accessing json decode output to update mysql tables


RevathySanthanam

Recommended Posts

I am using multiple levels of JSON data coming into php from a C# application, as in:

return new RootObject()
{
ID_Project = 4,
Name_Project = "Test",
Receiver_ID = 4,
Receiver_Name = "ABCDE",
UserID = 20,
UserRole = new User_Role()
{
ID_User = 20,
Role_User = "level 3",
User_Role_Description = "U",
UserGroup = new List<user_group>()
{
new User_Group() { ID_UserGroup = 30, Name_UserGroup = "usergroup8", UserID = 20 },
new User_Group() { ID_UserGroup = 31, Name_UserGroup = "usergroup9", UserID = 21 },
new User_Group() { ID_UserGroup = 32, Name_UserGroup = "usergroup10", UserID = 22 }
}
}
};

i am having troubles accessing the second level: UserRole and 3rd level: User_Group in my php script.
im currently trying like this:

foreach ($phpArray as $key => $value) {
echo "<h2>$key</h2>";
foreach ($value as $k => $v) {

echo "$k | $v
";

foreach ($v as $key1) {

echo "$key1
";
}
}
}

 

does anyone have an idea? :confused: :confused: :confused:

Thanks,
Revathy

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.