Pdo ile Sayfalama ve Arama
Selam Arkadaşlar pdo ile sayfalama ve arama konusunda yardıma ihtiyacım var
burada paylaşılan sayfalama functions kodlarına göre örnek(ürünler.php) dosyasının içerisinde
hem sayfalama hemde arama işlemini nasıl yapabilirim
Paylaşılan sayfalandırma kodları
<code>"function paginate($current_page, $total_records, $total_pages, $page_url){
$pagination = '';
if($total_pages > 0 && $total_pages != 1 && $current_page <= $total_pages){
$pagination .= '<ul>';
$right_links = $current_page + 3;
$previous = $current_page - 1;
$next = $current_page + 1;
$first_link = true;
if($current_page > 1){
$previous_link = ($previous==0)?1:$previous;
$pagination .= '<li class="pagination"><a href="'.$page_url.'?page=1" title="İlk">İlk</a></li>';
$pagination .= '<li class="pagination"><a href="'.$page_url.'?page='.$previous_link.'" title="Önceki">Önceki</a></li>';
for($i = ($current_page-2); $i < $current_page; $i++){
if($i > 0){
$pagination .= '<li class="pagination"><a href="'.$page_url.'?page='.$i.'">'.$i.'</a></li>';
}
}
$first_link = false;
}
if($first_link){
$pagination .= '<li class="active pagination">'.$current_page.'</li>';
}elseif($current_page == $total_pages){
$pagination .= '<li class="active pagination">'.$current_page.'</li>';
}else{
$pagination .= '<li class="active pagination">'.$current_page.'</li>';
}
for($i = $current_page+1; $i < $right_links ; $i++){
if($i<=$total_pages){
$pagination .= '<li class="pagination"><a href="'.$page_url.'?page='.$i.'">'.$i.'</a></li>';
}
}
if($current_page < $total_pages){
$next_link = ($next > $total_pages)? $total_pages : $next;
$pagination .= '<li class="pagination"><a href="'.$page_url.'?page='.$next_link.'" title="İleri">İleri</a></li>';
$pagination .= '<li class="pagination"><a href="'.$page_url.'?page='.$total_pages.'" title="Son">Son</a></li>';
}
$pagination .= '</ul>';
}
return $pagination;
}"</code>