$listar= $_GET['listar'];
$lerano= $_GET['ano'];
$section= $_GET['seccao'];
$page_name="index.php?seccao=noticias_piscina"; // If you use this code with a different page ( or file ) name then change this
$start=$_GET['start'];
if(strlen($start) > 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);
?>
$linha++;
}
?>
$query_img = "SELECT * FROM noticias_piscina_media WHERE id_noticia=$noticia[id] and tipo='1' ORDER by ordem ASC limit 1";
$result_img = mysqli_query($link, $query_img);
$fotografia = mysqli_fetch_array($result_img);
?>
ler mais
-
//// if our variable $back is equal to 0 or more then only we will display the link to move back ////////
if($back >=0) {
?>
- Ant } //////////////// Let us display the page links at center. We will not display the current page as a link ?> $i=0; $l=1; for($i=0;$i < $nume;$i=$i+$limit){ if($i <> $eu){ ?>
- } else { ?>
- } /// Current page is not displayed as link and given font color red $l=$l+1; } ?> ///////////// If we are not in the last page then Next link will be displayed. Here we check that ///// if($this1 < $nume) { ?>
- Seg } ?>