I am working on backend with mongodb & php. I have stored message content in mongodb database.
My mongodb database content is this
.......some content.........
"content": "This is the test message",
"time_created": 1418813065,
"status": "read",
"agencyStatus": "read",
"reply": [
{
"email": "[email protected]",
"name": "Accenture",
"content": "Thanks for your test message",
"time": 1418813145
}
]
In my program i am retriving the message content & reply content through foreach loop as is nested as a object inside.
<?php echo $mongoMessage['content'];?>
<?php foreach ($mongoMessage['reply'] as $mongoReply){ ?>
<?php echo $mongoReply['content']; ?>
My problem is when a record with reply exist i am retriving then it is displaying on browser but a record with no reply, i am retriving then it shows me notice on browser. How to get rid of this situation. This problm i am facing from last week plz help me guys...