<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<?
$servername='x'; // Your MySql Server Name or IP address here
$dbusername='x'; // Login user id here
$dbpassword='x'; // Login password here
$dbname='x'; // Your database name here
connecttodb($servername,$dbname,$dbusername,$dbpassword);
function connecttodb($servername,$dbname,$dbuser,$dbpassword)
{
global $link;
$link=mysql_connect ("$servername","$dbuser","$dbpassword");
if(!$link){die("Could not connect to MySQL");}
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
}
$page_name="index.php";
if(empty($_GET["cps"]))
{
$cps = "0";
}
else
{
$cps = $_GET["cps"];
}
/////////////////////////////////////////////////////////////////////////////////
$a = $cps+1;
$rpp = "10";
$lps = $cps - $rpp;
/////////////////////////////////////////////////////////////////////////////////
$q="Select SQL_CALC_FOUND_ROWS * from TABLOADI limit $cps, $rpp";
$rs=mysql_query($q) or die(mysql_error());
$nr = mysql_num_rows($rs);
$q0="Select FOUND_ROWS()";
$rs0=mysql_query($q0) or die(mysql_error());
$row0=mysql_fetch_array($rs0);
$nr0 = $row0["FOUND_ROWS()"];
echo "<td align=center><font face='Verdana' size='4'>$nr0 Records Found in <b>TOTAL</b></font><br><br></td>";
if(!isset($start)) {
$start = 0;
}
$eu = ($start -0);
$limit = 10;
$this = $eu + $limit;
$back = $eu - $limit;
$next = $eu + $limit;
$query2=" SELECT * FROM TABLOADI ";
$result2=mysql_query($query2);
echo mysql_error();
$nume=mysql_num_rows($result2);
$bgcolor="#f1f1f1";
echo "<TABLE border=1 width=100% align=center cellpadding=10 cellspacing=0> <tr>";
echo "<td bgcolor='dfdfdf' > <font face='arial,verdana,helvetica' color='#000000' size='4'>1</font></td>";
echo "<td bgcolor='dfdfdf' > <font face='arial,verdana,helvetica' color='#000000' size='4'>2</font></td>";
echo "<td bgcolor='dfdfdf' > <font face='arial,verdana,helvetica' color='#000000' size='4'>3</font></td>";
echo "<td bgcolor='dfdfdf' > <font face='arial,verdana,helvetica' color='#000000' size='4'>4</font></td>";
echo "<td bgcolor='dfdfdf'> <font face='arial,verdana,helvetica' color='#000000' size='4'>5</font></td></tr>";
$query=" SELECT * FROM TABLOADI limit $eu, $limit ";
$result=mysql_query($query);
echo mysql_error();
while($noticia = mysql_fetch_array($result))
{
if($bgcolor=='#f1f1f1'){$bgcolor='#ffffff';}
else{$bgcolor='#f1f1f1';}
echo "<tr >";
echo "<td align=left bgcolor=$bgcolor id='title'><font face='Verdana' size='2'>$noticia[row1]</font></td>";
echo "<td align=left bgcolor=$bgcolor id='title'><font face='Verdana' size='2'>$noticia[row2]</font></td>";
echo "<td align=left bgcolor=$bgcolor id='title'><font face='Verdana' size='2'><b>$noticia[row3]</font></td>";
echo "<td align=left bgcolor=$bgcolor id='title'><font face='Verdana' size='2'><b>$noticia[row4]</font></td>";
echo "<td align=left bgcolor=$bgcolor id='title'><font face='Verdana' size='2'>$noticia[row5]</font></td>";
echo "</tr>";
}
echo "</table>";
////////////////////////////// End of displaying the table with records ////////////////////////
$p_limit=10;
if(!isset($p_f)){$p_f=0;}
$p_fwd=$p_f+$p_limit;
$p_back=$p_f-$p_limit;
echo "<table align = 'center' width='50%'><tr><td align='left' width='20%'>";
if($p_f<>0){print "<a href='$page_name?start=$p_back&p_f=$p_back'><font face='Verdana' size='2'>PREV $p_limit</font></a>"; }
echo "</td><td align='left' width='10%'>";
if($back >=0 and ($back >=$p_f)) {
print "<a href='$page_name?start=$back&p_f=$p_f'><font face='Verdana' size='2'>PREV</font></a>";
}
echo "</td><td align=center width='30%'>";
for($i=$p_f;$i < $nume and $i<($p_f+$p_limit);$i=$i+$limit){
if($i <> $eu){
$i2=$i+$p_f;
echo " <a href='$page_name?start=$i&p_f=$p_f'><font face='Verdana' size='2'>$i</font></a> ";
}
else { echo "<font face='Verdana' size='4' color=red>$i</font>";}
}
echo "</td><td align='right' width='10%'>";
if($this < $nume and $this <($p_f+$p_limit)) {
print "<a href='$page_name?start=$next&p_f=$p_f'><font face='Verdana' size='2'>NEXT</font></a>";}
echo "</td><td align='right' width='20%'>";
if($p_fwd < $nume){
print "<a href='$page_name?start=$p_fwd&p_f=$p_fwd'><font face='Verdana' size='2'>NEXT $p_limit</font></a>";
}
echo "</td></tr></table>";
?>
<br>
<table border="0" cellpadding="4" cellspacing="1" width="20%" align="center">
<tr><td colspan="2" align=center><b><font face="verdana" size=3 color="#000000"><? echo "$nr0 Records Found"; ?></font></b></td></tr>
</table>
</body>
</html>