Hi I am trying to do the same thing. I would like to save the Facebook user timeline details OR messages in MySQL database. Timeline details are visible in screen total posts are like this http://screenshot.co/#!/2dcbee03ff , if I want to see the 'messages' only I can see in the screen like http://screenshot.co/#!/635a038dd5 but not able to store in database. I tried with the following Code snippet but I am not getting expected result. I am getting "Array" in the message field http://screenshot.co/#!/9385792e8a . Please help me how to store all messages in single row for single user.
$total_posts = array();
$posts_response = $posts_request->getGraphEdge();
if($fb->next($posts_response)) {
$response_array = $posts_response->asArray();
$total_posts = array_merge($total_posts, $response_array);
while ($posts_response = $fb->next($posts_response)) {
$response_array = $posts_response->asArray();
$total_posts = array_merge($total_posts, $response_array);
}
//print_r($total_posts);
foreach ($total_posts as $key ) {
echo $key['message'].'<br>';
}
} else {
$posts_response = $posts_request->getGraphEdge()->asArray();
print_r($posts_response);
}
// storing in the database.
$sql = "INSERT INTO users1 (name, token, message)
VALUES ('{$name}', '{$accessToken}', '{$total_posts}')";
if ($db->query($sql) === TRUE) {
echo "New record created successfully !!";
} else {
echo "Error: " . $sql . "<br>" . $db->error;
}
$db->close();