foreach ($albumsArray2 as $key => $value) {
     $i++;
     $mysql_album = mysql_query("SELECT * FROM planets_albums WHERE id='{$value}' LIMIT 1") or die("Sorry, we have a system error!");
     while ($row = mysql_fetch_array($mysql_album)) {
         $album_id = $row['id'];
         $item_id = $row['id'];
         $user_page_id = $row['user_page_id'];
         $user_post_id = $row['user_post_id'];
         $album_name = $row['album_name'];
         if (strlen($album_name) > 25) {
             $album_name = substr($album_name, 0, 25) . "...";
         }
         $album_type = $row['album_type'];
         $memory_type = $row['memory_type'];
         $upload_date = $row['upload_date'];
         $convertedTime = $myObject->convert_datetime($upload_date);
         $upload_date = $myObject->make_ago($convertedTime);
         $like_array_album = $row['like_array'];
         $love_array_album = $row['love_array'];
         $image_array = $row['image_array'];
         $likeArray_album = explode(",", $like_array_album);
         $loveArray_album = explode(",", $love_array_album);
         $imageArray = explode(",", $image_array);
         $like_array_count_album = count($likeArray_album);
         $love_array_count_album = count($loveArray_album);
         $image_array_count = count($imageArray);
         $point_array_album = $row['point_array'];
         $pointArray_album = explode(",", $point_array_album);
         $point_array_count_album = count($pointArray_album);
         $point_array_count_album = $point_array_count_album * 10;
         if ($point_array_album == "") {
$numRows = mysql_num_rows($mysql_union);
if ($numRows > 0) {
    while ($row = mysql_fetch_array($mysql_union)) {
        $item_id = $row['id'];
        $datetime = $row['datetime'];
        $union_type = $row['union_type'];
        if ($union_type == "albums_posts") {
            $mysql1 = mysql_query("SELECT * FROM planets_albums_posts WHERE id='{$item_id}' AND post_date='{$datetime}' LIMIT 1");
            while ($row = mysql_fetch_array($mysql1)) {
                $albums_post_id = $row['id'];
                $album_id = $row['album_id'];
                $user_page_id = $row['user_page_id'];
                $user_post_id = $row['user_post_id'];
                $the_post = $row['the_post'];
                $post_date = $row['post_date'];
                $convertedTime = $myObject->convert_datetime($post_date);
                $post_date = $myObject->make_ago($convertedTime);
                $albums_post_type = $row['albums_post_type'];
                $memory_type = $row['memory_type'];
                $comment_array = $row['comment_array'];
                $commentArray = explode(",", $comment_array);
                $comment_count = mysql_num_rows(mysql_query("SELECT id FROM planets_albums_posts_comments WHERE albums_post_id='{$albums_post_id}' AND delete_comment='1'"));
                $like_array_post = $row['like_array'];
                $love_array_post = $row['love_array'];
                $point_array_post = $row['point_array'];
                $likeArray_post = explode(",", $like_array_post);
                $loveArray_post = explode(",", $love_array_post);
                $pointArray_post = explode(",", $point_array_post);
                $like_array_count_post = count($likeArray_post);
                $love_array_count_post = count($loveArray_post);
                $point_array_count_post = count($pointArray_post);
                 $typex = "";
                 $typex_s = "";
             }
         }
     }
 }
 if ($union_type == "notes") {
     $mysql1 = mysql_query("SELECT * FROM notes WHERE id='{$item_id}' AND note_date='{$datetime}' LIMIT 1");
     while ($row = mysql_fetch_array($mysql1)) {
         $note_id = $row['id'];
         $item_id = $row['id'];
         $user_id_note = $row['user_id'];
         $the_note_subject = $row['the_note_subject'];
         $the_note = $row['the_note'];
         $note_date = $row['note_date'];
         $convertedTime = $myObject->convert_datetime($note_date);
         $note_date = $myObject->make_ago($convertedTime);
         $memory_type = $row['memory_type'];
         $note_type = $row['note_type'];
         $comment_array = $row['comment_array'];
         $commentArray = explode(",", $comment_array);
         $comment_count = mysql_num_rows(mysql_query("SELECT id FROM notes_comments WHERE note_id='{$note_id}' AND delete_comment='1'"));
         $like_array_note = $row['like_array'];
         $love_array_note = $row['love_array'];
         $point_array_note = $row['point_array'];
         $likeArray_note = explode(",", $like_array_note);
         $loveArray_note = explode(",", $love_array_note);
         $pointArray_note = explode(",", $point_array_note);
         $like_array_count_note = count($likeArray_note);
         $love_array_count_note = count($loveArray_note);
         $point_array_count_note = count($pointArray_note);
     $hide_llc_back = "";
 } else {
     $hide_llc_front = "";
     $hide_llc_back = "";
 }
 if ($union_type == "notes") {
     $mysql1 = mysql_query("SELECT * FROM planets_notes WHERE id='{$item_id}' AND note_date='{$datetime}' LIMIT 1");
     while ($row = mysql_fetch_array($mysql1)) {
         $note_id = $row['id'];
         $item = $row['id'];
         $user_page_id = $row['user_page_id'];
         $user_post_id = $row['user_post_id'];
         $the_note_subject = $row['the_note_subject'];
         $the_note = $row['the_note'];
         $note_date = $row['note_date'];
         $convertedTime = $myObject->convert_datetime($note_date);
         $note_date = $myObject->make_ago($convertedTime);
         $memory_type = $row['memory_type'];
         $note_type = $row['note_type'];
         $comment_array = $row['comment_array'];
         $commentArray = explode(",", $comment_array);
         $comment_count = mysql_num_rows(mysql_query("SELECT id FROM planets_notes_comments WHERE note_id='{$note_id}' AND delete_comment='1'"));
         $like_array_note = $row['like_array'];
         $love_array_note = $row['love_array'];
         $point_array_note = $row['point_array'];
         $likeArray_note = explode(",", $like_array_note);
         $loveArray_note = explode(",", $love_array_note);
         $pointArray_note = explode(",", $point_array_note);
         $like_array_count_note = count($likeArray_note);
         $love_array_count_note = count($loveArray_note);
         $point_array_count_note = count($pointArray_note);
 $transaction_id = $row['id'];
 $transaction_date = $row['transaction_date'];
 $union_type = $row['union_type'];
 if ($union_type == "transactions") {
     $mysql1 = mysql_query("SELECT * FROM point_transactions WHERE id='{$transaction_id}' AND transaction_date='{$transaction_date}' LIMIT 1");
     while ($row = mysql_fetch_array($mysql1)) {
         $transaction_id = $row['id'];
         $plus_id = $row['plus_id'];
         $minus_id = $row['minus_id'];
         $item_id = $row['item_id'];
         $create_type = $row['create_type'];
         $create_id = $row['create_id'];
         $transaction_amount = $row['transaction_amount'];
         $transaction_type = $row['transaction_type'];
         $transaction_date = $row['transaction_date'];
         $convertedTime = $myObject->convert_datetime($transaction_date);
         $transaction_date = $myObject->make_ago($convertedTime);
     }
     $item_type = json_encode($transaction_type);
     $create_type_json = json_encode($create_type);
     $tt_text = "This";
     if ($create_type == "profile") {
         $create_text = "profiles";
         $location_text = "Profile";
     } else {
         if ($create_type == "planet") {
             $create_text = "planets";
             $location_text = "Planet";
         }
     }
     $create_text_s = substr($create_text, 0, -1);
 } else {
     if ($union_type == "link_creates") {
         $mysql1 = mysql_query("SELECT * FROM link_creates WHERE id='{$item_id}' AND link_create_date='{$datetime}' LIMIT 1");
         while ($row = mysql_fetch_array($mysql1)) {
             $link_create_id = $row['id'];
             $user_page_id = $row['user_page_id'];
             $user_post_id = $row['user_post_id'];
             $planet_id = $row['planet_id'];
             $page_id = $row['page_id'];
             $group_id = $row['group_id'];
             $event_id = $row['event_id'];
             $shop_id = $row['shop_id'];
             $create_type = $row['create_type'];
             $create_type_s = substr($create_type, 0, -1);
             $link_create_date = $row['link_create_date'];
             $convertedTime = $myObject->convert_datetime($link_create_date);
             $link_create_date = $myObject->make_ago($convertedTime);
             $link_create_type = $row['link_create_type'];
             $memory_type = $row['memory_type'];
             $comment_array = $row['comment_array'];
             $commentArray = explode(",", $comment_array);
             $comment_count = mysql_num_rows(mysql_query("SELECT id FROM link_creates_comments WHERE link_create_id='{$link_create_id}' AND delete_comment='1'"));
             $like_array_link_create = $row['like_array'];
             $love_array_link_create = $row['love_array'];
             $point_array_link_create = $row['point_array'];
             $likeArray_link_create = explode(",", $like_array_link_create);
             $loveArray_link_create = explode(",", $love_array_link_create);
             $pointArray_link_create = explode(",", $point_array_link_create);
             $like_array_count_link_create = count($likeArray_link_create);
             $love_array_count_link_create = count($loveArray_link_create);
             $point_array_count_link_create = count($pointArray_link_create);
     }
 }
 // End Pagination
 $planetsDisplayList .= "<div class='planets_bars'>\n\t\t\t\t\t\t<div class='float_left'><img src='blank.gif' width='1px' height='1px' class='planets_lists'/><span class='heading_list'>" . $tab_heading . " Planets</span></div>\n\t\t\t\t\t<div class='float_right'>" . $list_planets . "</div></div>";
 $i = 0;
 $planetsDisplayList .= "<div class='under_list_wrap'>";
 foreach ($planetsArray2 as $key => $value) {
     $i++;
     $mysql_planets = mysql_query("SELECT * FROM planets WHERE id='{$value}' AND delete_item='1' LIMIT 1") or die("Sorry, we have a system error!");
     while ($row = mysql_fetch_array($mysql_planets)) {
         $planet_id = $row['id'];
         $item_id = $row['id'];
         $user_id = $row['user_id'];
         $planet_name = $row['planet_name'];
         $create_date = $row['create_date'];
         $convertedTime = $myObject->convert_datetime($create_date);
         $create_date = $myObject->make_ago($convertedTime);
         $like_array_planets = $row['like_array'];
         $love_array_planets = $row['love_array'];
         $member_array_planets = $row['member_array'];
         $likeArray_planets = explode(",", $like_array_planets);
         $loveArray_planets = explode(",", $love_array_planets);
         $memberArray_planets = explode(",", $member_array_planets);
         $like_array_count_planets = count($likeArray_planets);
         $love_array_count_planets = count($loveArray_planets);
     }
     $member_array_count_planets = count($memberArray_planets);
     if ($member_array_count_planets != 1) {
         $m_s = "s";
     } else {
         $m_s = "";
}
$numRows = mysql_num_rows($mysql_union);
if ($numRows > 0) {
    while ($row = mysql_fetch_array($mysql_union)) {
        $item_id = $row['id'];
        $datetime = $row['datetime'];
        $union_type = $row['union_type'];
        if ($union_type == "posts") {
            $mysql1 = mysql_query("SELECT * FROM posts WHERE id='{$item_id}' AND post_date='{$datetime}' LIMIT 1");
            while ($row = mysql_fetch_array($mysql1)) {
                $post_id = $row['id'];
                $user_page_id = $row['user_page_id'];
                $user_post_id = $row['user_post_id'];
                $the_post = $row['the_post'];
                $post_date = $row['post_date'];
                $convertedTime = $myObject->convert_datetime($post_date);
                $post_date = $myObject->make_ago($convertedTime);
                $post_type = $row['post_type'];
                $memory_type = $row['memory_type'];
                $comment_array = $row['comment_array'];
                $commentArray = explode(",", $comment_array);
                $comment_count = mysql_num_rows(mysql_query("SELECT id FROM posts_comments WHERE post_id='{$post_id}' AND delete_comment='1'"));
                $like_array_post = $row['like_array'];
                $love_array_post = $row['love_array'];
                $point_array_post = $row['point_array'];
                $likeArray_post = explode(",", $like_array_post);
                $loveArray_post = explode(",", $love_array_post);
                $pointArray_post = explode(",", $point_array_post);
                $like_array_count_post = count($likeArray_post);
                $love_array_count_post = count($loveArray_post);
                $point_array_count_post = count($pointArray_post);