$posts = json_decode(file_get_contents("https://api.vk.com/method/wall.get?&owner_id=$owner_id&count=100&access_token=$service"));
$inserts = array();
foreach ($posts->response as $res => $result) {
if ($res < 2) continue;
$id = $result->id;
$artist = $result->attachments[1]->audio->artist;
$title = $result->attachments[1]->audio->title;
$inserts[] = "(".(int)$id.", '".$mysqli->real_escape_string($artist)."', '".$mysqli->real_escape_string($title)."')";
echo "<pre>";
echo "$id | $artist | $title";
echo "</pre>";
}
if (sizeof($inserts) > 0) {
$mysqli->query("INSERT INTO `table` (`id`, `artist`, `title`) VALUES ".implode(',', $inserts)."");
}