Ive got a problem. In each document I ve got fields: threads.id and posts.id.
I want to get the field name value for them so i can get data from the database.
Between the lines beneath i have marked the lines where i want to get the fields.
But it returns error because they are $doc is object.
How can i get the fields? I have to do it when it iterates the document and not when it iterates the $field and $value.
// iterate document
foreach ($results->response->docs as $doc)
{
---------------------------------------
$forum_model->get_country_id_by_thread_id($doc[ threads.id ]);
$forum_model->get_user_id_by_thread_id($doc[ posts.id ]);
----------------------------------------
// iterate document fields / values
foreach ($doc as $field => $value)
{
echo htmlspecialchars($field, ENT_NOQUOTES, utf-8 ) . "<br />";
echo htmlspecialchars($value, ENT_NOQUOTES, utf-8 ) . "<br />";
//echo $doc[ threads.title ] . "<br/>";
}
}