Wiem że to błahy problem ale raczkuję w temacie i sam sobie nie mogę poradzić. Co zrobić aby linki paginacji nie wyświetlały się gdy wyniki wyszukiwania zmieszczą się na pierwszej stronie.
Proszę o pomoc!
<?php // database connection info // find out how many rows are in the table $sql = "SELECT * FROM tabela"; $numrows = $r[0]; // number of rows to show per page $rowsperpage = 2; // find out total pages // get the current page or set a default // cast var as int $podstrona = (int) $_GET['podstrona']; } else { // default page num $podstrona = 1; } // end if // if current page is greater than total pages... if ($podstrona > $totalpages) { // set current page to last page $podstrona = $totalpages; } // end if // if current page is less than first page... if ($podstrona < 1) { // set current page to first page $podstrona = 1; } // end if // the offset of the list, based on current page $offset = ($podstrona - 1) * $rowsperpage; // get the info from the db $sql = "SELECT * FROM tabela WHERE nazwa LIKE '".$nazwa."%' AND jednorodzinne LIKE '".$jednorodzinne."%' ORDER BY id ASC LIMIT $offset, $rowsperpage"; // while there are rows to be fetched... // echo data echo '<ul align="center" style="width:540px; list-style:none; list-style-type:none; margin:0; padding-left:20;">'; echo '<li style="float:left; width:250px; height:220px; margin:0; padding:10;"> '; } ?> </div> <div style="float: left; margin: 5px; padding-left:20px;"> <table align="center"><tr><td class="linkPaginacja"> <?php $range = 3; // if not on page 1, don't show back links if ($podstrona > 1) { // show << link to go back to page 1 // get previous page num $prevpage = $podstrona - 1; // show < link to go back to 1 page } // end if // loop to show links to range of pages around current page for ($x = ($podstrona - $range); $x < (($podstrona + $range) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $totalpages)) { // if we're on current page... if ($x == $podstrona) { // 'highlight' it but don't make a link // if not current page... } else { // make it a link } // end else } // end if } // end for // if not on last page, show forward and last page links if ($podstrona != $totalpages) { // get next page $nextpage = $podstrona + 1; // echo forward link for next page // echo forward link for lastpage } // end if /****** end build pagination links ******/ ?>