$listar= $_GET['listar'];
$lerano= $_GET['ano'];
$page_name="index.php?seccao=ministros"; // 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 = 4; // 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///////
/// AND c8 >= DATE(curdate()) AND c8 <= DATE_ADD(DATE(curdate()), INTERVAL 30 DAY) ////
if($lerano==""){
$query2=" SELECT * FROM artigos WHERE seccao='ministros' AND data >= DATE(curdate()) AND data <= DATE_ADD(DATE(curdate()), INTERVAL 30 DAY)
order by data asc";
}
else {
$query2=" SELECT * FROM artigos WHERE seccao='ministros' AND data LIKE '$lerano-$listar-%%' order by data desc";
}
$result2=mysql_query($query2);
echo mysql_error();
$nume=mysql_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 artigos WHERE seccao='ministros' AND data >= DATE(curdate()) AND data <= DATE_ADD(DATE(curdate()), INTERVAL 30 DAY) ORDER BY data ASC limit $eu, $limit ";
}
else {
$query=" SELECT * FROM artigos WHERE seccao='ministros' AND data LIKE '$lerano-$listar-%%' ORDER BY data DESC limit $eu, $limit ";
}
$result=mysql_query($query);
echo mysql_error();
$linha=0;
//////////////// Now we will display the returned records in side the rows of the table/////////
while($noticia = mysql_fetch_array($result))
{
$titulo_registo= $noticia['c1'];
$titulo_registo= htmlentities( $titulo_registo, ENT_COMPAT, 'ISO-8859-1');
$titulo_registo= nl2br($titulo_registo);
$c2_registo= $noticia['c2'];
$c2_registo= htmlentities( $c2_registo, ENT_COMPAT, 'ISO-8859-1');
$c2_registo= nl2br($c2_registo);
$c3_registo= $noticia['c3'];
$c3_registo= htmlentities( $c3_registo, ENT_COMPAT, 'ISO-8859-1');
$c3_registo= nl2br($c3_registo);
$c4_registo= $noticia['c4'];
$c4_registo= htmlentities( $c4_registo, ENT_COMPAT, 'ISO-8859-1');
$c4_registo= nl2br($c4_registo);
$c5_registo= $noticia['c5'];
$c5_registo= htmlentities( $c5_registo, ENT_COMPAT, 'ISO-8859-1');
$c5_registo= nl2br($c5_registo);
$c6_registo= $noticia['c6'];
$c6_registo= htmlentities( $c6_registo, ENT_COMPAT, 'ISO-8859-1');
$c6_registo= nl2br($c6_registo);
$c7_registo= $noticia['c7'];
$c7_registo= htmlentities( $c7_registo, ENT_COMPAT, 'ISO-8859-1');
$c7_registo= nl2br($c7_registo);
$c8_registo= $noticia['c8'];
$c8_registo= htmlentities( $c8_registo, ENT_COMPAT, 'ISO-8859-1');
$c8_registo= nl2br($c8_registo);
$c9_registo= $noticia['c9'];
$c9_registo= htmlentities( $c9_registo, ENT_COMPAT, 'ISO-8859-1');
$c9_registo= nl2br($c9_registo);
$c10_registo= $noticia['c10'];
$c10_registo= htmlentities( $c10_registo, ENT_COMPAT, 'ISO-8859-1');
$c10_registo= nl2br($c10_registo);
$c11_registo= $noticia['c11'];
$c12_registo= $noticia['c12'];
$c12_registo= htmlentities( $c12_registo, ENT_COMPAT, 'ISO-8859-1');
$c12_registo= nl2br($c12_registo);
$c13_registo= $noticia['c13'];
$c13_registo= htmlentities( $c13_registo, ENT_COMPAT, 'ISO-8859-1');
$c13_registo= nl2br($c13_registo);
$c14_registo= $noticia['c14'];
$c14_registo= htmlentities( $c14_registo, ENT_COMPAT, 'ISO-8859-1');
$c14_registo= nl2br($c14_registo);
$c15_registo= $noticia['c15'];
$c15_registo= htmlentities( $c15_registo, ENT_COMPAT, 'ISO-8859-1');
$c15_registo= nl2br($c15_registo);
$data_registo= $noticia['data'];
$c8= $noticia['c8'];
?>
if ($c4_registo!=""){
?>
}
if ($c6_registo!=""){
?>
}
if ($c8_registo!=""){
?>
}
if ($c10_registo!=""){
?>
}
?>
$linha++;
}
?>