<?php
$page = 1;
if(isset($_GET['page'])){
$page=$_GET['page'];
}
$conn=mysql_connect('localhost','root','');
mysql_select_db('test',$conn);
$result_num_PerPage = 5;
$startResults = ($page - 1) * $result_num_PerPage;
$number_Of_Rows = mysql_num_rows(mysql_query('SELECT id FROM page',$conn));
$totalPages = ceil($number_Of_Rows / $result_num_PerPage);
$select = mysql_query("SELECT * FROM wp_usermeta LIMIT $startResults, $result_num_PerPage",$conn);
while ($output = mysql_fetch_assoc($select))
{
echo $output['meta_key'].'<br />';
}
if($page>1)
{
$a=1;
echo '<a href="?page='.$a.'">first</a> ';
}
if($page > 1)
echo '<a href="?page='.($page - 1).'">Prev</a> ';
for($i = 1; $i <= $totalPages; $i++)
{
if($i == $page)
echo '<strong>'.$i.'</strong> ';
else
echo '<a href="?page='.$i.'">'.$i.'</a> ';
}
if ($page < $totalPages)
echo '<a href="?page='.($page + 1).'">Next</a> ';
if($page!=$totalPages)
echo '<a href="?page='.$totalPages.'">Last</a>';
?>
$page = 1;
if(isset($_GET['page'])){
$page=$_GET['page'];
}
$conn=mysql_connect('localhost','root','');
mysql_select_db('test',$conn);
$result_num_PerPage = 5;
$startResults = ($page - 1) * $result_num_PerPage;
$number_Of_Rows = mysql_num_rows(mysql_query('SELECT id FROM page',$conn));
$totalPages = ceil($number_Of_Rows / $result_num_PerPage);
$select = mysql_query("SELECT * FROM wp_usermeta LIMIT $startResults, $result_num_PerPage",$conn);
while ($output = mysql_fetch_assoc($select))
{
echo $output['meta_key'].'<br />';
}
if($page>1)
{
$a=1;
echo '<a href="?page='.$a.'">first</a> ';
}
if($page > 1)
echo '<a href="?page='.($page - 1).'">Prev</a> ';
for($i = 1; $i <= $totalPages; $i++)
{
if($i == $page)
echo '<strong>'.$i.'</strong> ';
else
echo '<a href="?page='.$i.'">'.$i.'</a> ';
}
if ($page < $totalPages)
echo '<a href="?page='.($page + 1).'">Next</a> ';
if($page!=$totalPages)
echo '<a href="?page='.$totalPages.'">Last</a>';
?>
No comments:
Post a Comment