I want to pagination using 2 different data sources using PHP.
1, Mysql database
2, Text file
start pagination 1 page from MySQL database data and the end to text file data
Example: in start show data from MySQL DB and then when database data ends then show from text file
Example: 1 to 6 pages show data from db and after page 6 data show from text file
here is text file fetch code
Bro here is text file fetch code
function FetchUsernames(){
$file_contents = file_get_contents('review_files/usernames.txt');
$usernames = explode("
",$file_contents);
shuffle($usernames);
return $usernames;
}
function FetchReviewTitles(){
$file_contents = file_get_contents('review_files/review_titles.txt');
$titles = explode("
",$file_contents);
shuffle($titles);
return $titles;
}
function FetchReviews(){
$file_contents = file_get_contents('review_files/reviews.txt');
$reviews = explode("|",$file_contents);
shuffle($reviews);
return $reviews;
}
function MergeTXTFilesData(){
$FetchUsernames = FetchUsernames();
$FetchReviewTitles = FetchReviewTitles();
$FetchReviews = FetchReviews();
foreach ($FetchUsernames as $key => $username){
if (isset($FetchReviewTitles[$key]) && isset($FetchReviews[$key])){
$Reviews[$key]['username'] = $username;
$Reviews[$key]['title'] = $FetchReviewTitles[$key];
$Reviews[$key]['review'] = $FetchReviews[$key];
}
}
return $Reviews;
and we fetched data from mysql and paginated
but now we need to merge pagination