ok
Direktori : /home2/selectio/public_html/tnpsctestbatch.com/api/ |
Current File : /home2/selectio/public_html/tnpsctestbatch.com/api/titles-list-api.php |
<?php include"../config/config.php"; $view_profile_condition =''; if($_POST['type']=="titles"){ try{ $data=""; $itemsPerPage = 10; $current_page = isset($_POST['cur_page']) ? $_POST['cur_page'] : 1; $offset = ($current_page - 1) * $itemsPerPage; $condition = ""; if(isset($_POST['date'])){ $current_date = $_POST['date']; } $statement = $pdo->prepare("SELECT * FROM tbl_current_affairs_titile WHERE tbl_current_affairs_titile.current_status=1 ORDER BY tbl_current_affairs_titile.current_date DESC LIMIT $itemsPerPage "); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); $statement = $pdo->prepare("SELECT * FROM tbl_current_affairs_titile WHERE current_status=1 ORDER BY tbl_current_affairs_titile.current_date DESC"); $statement->execute(); $rowCount = $statement->rowCount(); // Calculate the total number of pages $totalPages = ceil($rowCount / $itemsPerPage); $data=""; foreach($result as $result_dats){ $query_question = $pdo->prepare("SELECT * FROM tbl_current_affairs WHERE title_id=".$result_dats['id']." ORDER BY current_date DESC"); $query_question->execute(); $result_questions = $query_question->fetchAll(PDO::FETCH_ASSOC); $total_question = $query_question->rowCount(); $data.='<li> <div class="twm-employer-list-style1 mb-5"> <div class="twm-media"> <a href="quiz/current-affair-exam.php?title_id='.$result_dats['id'].'" class="twm-job-title"> <img src="admin/'.$result_dats['thumpnail'].'" alt="#" style="height: 100%;width: 100%;"> </a> </div> <div class="twm-mid-content"> <a href="quiz/current-affair-exam.php?title_id='.$result_dats['id'].'" class="twm-job-title"> <h4>'.$result_dats['current_title'].'</h4> </a> <div class="twm-jobs-vacancies total_quetions_no"><b><span>'.$total_question.'</span> Quizzes</b></div> <p class="twm-job-address">'.$result_dats['current_date']. '</p> <a href="quiz/current-affair-exam.php?title_id='.$result_dats['id'].'" class="btn btn-primary get_started" id=""> Get start </a> </div> <div class="twm-right-content"> </div> </div> </li>'; } if($data==''){ echo '<center>No date Found</center>'; }else{ $data.=' <br><br><div class="scrollmenu">'; if($current_page > 1){ $data.= '<a href="today-current-affairs-in-tamil-for-TNPSC.php?page='.($current_page - 1).'" class="btn btn-info btn-xs"> << Priviews</a> '; } for($i = 1; $i <= $totalPages; $i++){ if($i == $current_page){ $btn='success';}else{$btn='default'; } $data.= '<a href="today-current-affairs-in-tamil-for-TNPSC.php?page='.$i.'" class="btn btn-'.$btn.' btn-xs"> '.($i).'</a> '; } if($current_page < $totalPages){ $data.= '<a href="today-current-affairs-in-tamil-for-TNPSC.php?page='.($current_page+1).'" class="btn btn-info btn-xs">Next >></a> '; } $data.='</div>'; echo $data; } }catch(exception $e){ echo $e; } } ?>