0 and !is_numeric($start)){ echo "Data Error"; exit; } $eu = ($start - 0); $limit = 6; // No of records to be shown per page. $this1 = $eu + $limit; $back = $eu - $limit; $next = $eu + $limit; /////////////// WE have to find out the number of records in our table. We will use this to break the pages/////// if($lerano==""){ $query2=" SELECT * FROM noticias_piscina WHERE seccao='noticias_piscina' order by data desc, c3 ASC"; } else { $query2=" SELECT * FROM noticias_piscina WHERE seccao='noticias_piscina' AND data LIKE '$lerano-$listar-%%' order by data desc"; } $result2=mysqli_query($link, $query2); $nume=mysqli_num_rows($result2); /////// The variable nume above will store the total number of records in the table//// /////////// Now let us print the table headers //////////////// $bgcolor="#f1f1f1"; ////////////// Now let us start executing the query with variables $eu and $limit set at the top of the page/////////// if($lerano==""){ $query=" SELECT * FROM noticias_piscina WHERE seccao='noticias_piscina' ORDER BY data DESC, c3 ASC limit $eu, $limit "; } else { $query=" SELECT * FROM noticias_piscina WHERE seccao='noticias_piscina' AND data LIKE '$lerano-$listar-%%' ORDER BY data DESC limit $eu, $limit "; } $result=mysqli_query($link, $query); $linha=0; //////////////// Now we will display the returned records in side the rows of the table///////// while($noticia = mysqli_fetch_array($result)) { $titulo_registo= $noticia['c1']; $titulo_registo= htmlentities( $titulo_registo, ENT_COMPAT, 'ISO-8859-1'); $titulo_registo= nl2br($titulo_registo); $titresumo= substr( $titulo_registo, 0, 83); $texto_registo= $noticia['c4']; $texto_registo= htmlentities( $texto_registo, ENT_COMPAT, 'ISO-8859-1'); $texto_registo= nl2br($texto_registo); $resumo= substr( $noticia['c4'], 0, 60); $resumo= htmlentities( $resumo, ENT_COMPAT, 'ISO-8859-1'); $resumo= nl2br($resumo); ?>
$limit ){ // Let us display bottom links if sufficient records are there for paging /////////////// Start the bottom links with Prev and next link with page numbers ///////////////// ?>