sorry,the earlier coding is wrong.this is the correct coding that have probelm that i want to solve
have problem in display the records in the next page.when i select the month and year from the puill down,it display the first 50 records and it will display the next 50 records in the next page.but it didnt display the next 50 records in the next page.....i included the coding below..anybody can help?whats is missing
<?php
if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); }
if(is_admin('2')) {
$mod_admin = "en_aview";
$mod_title = "ACTIVITY VIEWING";
/******************************************************/
/ Functions /
/******************************************************/
function select_date($name,$year,$month){
$select = "<select name=\"".$name."_month\">";
$select .= "<option value=\"00\">-----</option>";
for ($im=1; $im < 13 ; $im++){
$select .= "<option value=\"$im\"";
if($month == $im) $select .=" selected=\"selected\"";
$select .= " >".date("F", mktime(2, 0, 0, $im, 1, 2000) )."</option>";
}
$select .= "</select>";
$select .= "<select name=\"".$name."_year\">";
$year_end = date("Y") + 1;
$select .= "<option value=\"0000\">----</option>";
for ($iy = 2000 ; $iy < $year_end; $iy++){
$select .= "<option value=\"$iy\"";
if($year == $iy) $select .=" selected=\"selected\"";
$select .= ">".$iy."</option>";
}
$select .= "</select>";
return $select;
}
function menu($start_year,$start_month){
global $mod_admin,$mod_title;
echo "<center><div class='title'>".$mod_title."</div></center><br />";
echo "<form method='post' action='".$_SERVER["PHPSELF"]."'>";
echo "<table width='200' border='0' cellspacing='0' align='center'>";
echo "<tr><td>".select_date("start",$start_year,$start_month);
echo "</td><td>"
."<input type='submit' name='submitok' value=' Go '>"
."<input type='hidden' name='op' value='".$mod_admin."'>"
."</td></tr>";
echo "</table></form>";
echo "<br />";
}
function main($submitok,$start_year,$start_month){
global $mod_admin,$db,$mainfile,$userdata,$mod_title;
include ("header.php");
AdminLinks();
OpenTable3("96%");
echo "<br />";
menu($start_year,$start_month);
if($submitok){
$start = mktime(0, 0, 0, $start_month, 1, $start_year);
$end = mktime(0, 0, 0, $start_month, 31, $start_year);
if(!isset($page)) $page = 1;
$pagesize = 50;
$sqlSearch = "SELECT id,date,ip,login,activity FROM ".EN_ACTIVITY_TABLE." WHERE date >= $start AND date <= $end ORDER BY date";
$pagination = new datapager($sqlSearch);
$res = $pagination->execute($page, $pagesize);
echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"5\" align=\"center\">";
echo "<tr bgcolor=\"#FF9900\" align='center'><td colspan=\"2\"><font color=\"#000000\"><b>Activity Report</b></font></td></tr>";
echo "<table width='100%' cellpadding='5' cellspacing='0' border='1'>";
echo "<tr><td><b>DATE</b></td><td><b>USER ID</b></td><td><b>ACTIVITY</b></td><td><b>IP ADDRESS</b></td></tr>";
if( $res ){
while ( $row = $db->sql_fetchrow($res) )
{
$result = $db->sql_query("SELECT title FROM ".EN_ACTIVITY_CAT_TABLE." WHERE id='".$row['activity']."'");
list($act_title) = $db->sql_fetchrow($result);
$result2 = $db->sql_query("SELECT username FROM ".USERS_TABLE." WHERE user_id='".$row['login']."'");
list($username) = $db->sql_fetchrow($result2);
echo "<tr><td>".date("d-M-Y",$row['date'])."</td><td>".$username."</td><td>".$act_title."</td><td>".$row['ip']."</td></tr>";
}
}
echo "</table>";
// Gets the current records according to the current page
echo "<center><br>";
echo $pagination->prevpage("<a href='".$_SERVER["PHPSELF"]."?op=$mod_admin&do=doresult&realname=$realname&username=$username&start_year=$start_year&start_month=$start_month&page=%page%'>< Previous</a> \n")
."Page: <strong>".$pagination->page." of ".$pagination->pagecount."</strong>"
." ".$pagination->nextpage("<a href='".$_SERVER["PHPSELF"]."?op=$mod_admin&do=doresult&realname=$realname&username=$username&start_year=$start_year&start_month=$start_month&page=%page%'>Next ></a>")
."<br>";
// Gets the links for browsing
echo "<table width='100%' align='center'><tr>\n";
echo "<td width='96%' align='center'>".$pagination->pagelinks("<a href='".$_SERVER["PHPSELF"]."?op=$mod_admin&do=doresult&realname=$realname&username=$username&start_year=$start_year&start_month=$start_month&page=%page%'>%page%</a>", "%page%");
echo "</td></tr></table>";
echo "</center><br />";
echo "<tr><td colspan=\"2\"><br /></td></tr>"
."</table>";
$result = $db->sql_query("INSERT INTO ".EN_ACTIVITY_TABLE." SET date=UNIX_TIMESTAMP(CURDATE()),ip='".getenv("REMOTE_ADDR")."',login='".$userdata["user_id"]."',activity='10'"); // Activity Viewing
} else {
echo "<center><b>No result found</b></center>";
echo "<br /><br />";
}
CloseTable3();
include ("footer.php");
}
switch($do){
default:
main($submitok,$start_year,$start_month);
break;
}
} else {
include ('header.php');
AdminLinks();
OpenTable3("90%");
echo "<br><center><div class=\"title\">Access Denied!</div></center>";
echo "<br>";
OpenTable("100%");
echo "<center>Sorry! You are not authorized to perform this task.</center>";
echo "<br><br>";
CloseTable();
CloseTable3();
include("footer.php");
}
?>