next page problem

i have problem with this coding below.when i select the month and year,it will display the first 50 records.then the next 50 records will display in the next page.the problem is when i click the next page,it wont display the next 50 records,it will just display no result found.this coding is wrriten by previous programmer and im having headache on his coding!anybody can help?



<?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 .= "-----";
for ($im=1; $im < 13 ; $im++){
$select .= "".date("F", mktime(2, 0, 0, $im, 1, 2000) )."";
}
$select .= "";

$select .= "";
$year_end = date("Y") + 1;
$select .= "----";
for ($iy = 2000 ; $iy < $year_end; $iy++){
$select .= "".$iy."";
}
$select .= "";

return $select;
}

function menu($start_year,$start_month){
global $mod_admin,$mod_title;

echo "
".$mod_title."

";
echo "";
echo "";
echo "";
echo "
".select_date("start",$start_year,$start_month);
echo "
"
.""
.""
."
";
echo "
";
}

function main($submitok,$start_year,$start_month){
global $mod_admin,$db,$mainfile,$userdata,$mod_title;
include ("header.php");
AdminLinks();

OpenTable3("96%");
echo "
";
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 "";
echo "";
echo "";
echo "";

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 "";
}
}

echo "
Activity Report
DATEUSER IDACTIVITYIP ADDRESS
".date("d-M-Y",$row['date'])."".$username."".$act_title."".$row['ip']."
";
// Gets the current records according to the current page
echo "

";
echo $pagination->prevpage("< Previous  
")
."Page: ".$pagination->page." of ".$pagination->pagecount.""
."  ".$pagination->nextpage("Next >")
."
";

// Gets the links for browsing
echo "
";
echo "
".$pagination->pagelinks("%page%", "%page%");
echo "
";
echo "

";
echo "
"
."";
$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 "
No result found
";
echo "

";
}
CloseTable3();
include ("footer.php");
}

switch($do){
default:
main($submitok,$start_year,$start_month);
break;
}

} else {
include ('header.php');
AdminLinks();
OpenTable3("90%");
echo "
Access Denied!
";
echo "
";
OpenTable("100%");
echo "
Sorry! You are not authorized to perform this task.
";
echo "

";
CloseTable();
CloseTable3();
include("footer.php");
}
?>

Comments

  • Be more specific in your questions and don't just paste your whole application in the messageboard. Hint: Only paste those pieces of code you thing are the problem. Place [ code ] labels around it so your incrementations will display correct and maybe someone will actually look at your code and help you with your problem. I don't think many people are inspired to read ALL this great code you wrote when it isn't formatted in any way...


    : i have problem with this coding below.when i select the month and year,it will display the first 50 records.then the next 50 records will display in the next page.the problem is when i click the next page,it wont display the next 50 records,it will just display no result found.this coding is wrriten by previous programmer and im having headache on his coding!anybody can help?
    :
    :
    :
    : <?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 .= "-----";
    : for ($im=1; $im < 13 ; $im++){
    : $select .= "".date("F", mktime(2, 0, 0, $im, 1, 2000) )."";
    : }
    : $select .= "";
    :
    : $select .= "";
    : $year_end = date("Y") + 1;
    : $select .= "----";
    : for ($iy = 2000 ; $iy < $year_end; $iy++){
    : $select .= "".$iy."";
    : }
    : $select .= "";
    :
    : return $select;
    : }
    :
    : function menu($start_year,$start_month){
    : global $mod_admin,$mod_title;
    :
    : echo "
    ".$mod_title."

    ";
    : echo "";
    : echo "";
    : echo "";
    : echo "
    ".select_date("start",$start_year,$start_month);
    : echo "
    "
    : .""
    : .""
    : ."
    ";
    : echo "
    ";
    : }
    :
    : function main($submitok,$start_year,$start_month){
    : global $mod_admin,$db,$mainfile,$userdata,$mod_title;
    : include ("header.php");
    : AdminLinks();
    :
    : OpenTable3("96%");
    : echo "
    ";
    : 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 "";
    : echo "";
    : echo "";
    : echo "";
    :
    : 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 "";
    : }
    : }
    :
    : echo "
    Activity Report
    DATEUSER IDACTIVITYIP ADDRESS
    ".date("d-M-Y",$row['date'])."".$username."".$act_title."".$row['ip']."
    ";
    : // Gets the current records according to the current page
    : echo "
    ";
    : echo $pagination->prevpage("< Previous  
    ")
    : ."Page: ".$pagination->page." of ".$pagination->pagecount.""
    : ."  ".$pagination->nextpage("Next >")
    : ."";
    :
    : // Gets the links for browsing
    : echo "
    ";
    : echo "
    ".$pagination->pagelinks("%page%", "%page%");
    : echo "
    ";
    : echo "

    ";
    : echo "
    "
    : ."";
    : $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 "
    No result found
    ";
    : echo "

    ";
    : }
    : CloseTable3();
    : include ("footer.php");
    : }
    :
    : switch($do){
    : default:
    : main($submitok,$start_year,$start_month);
    : break;
    : }
    :
    : } else {
    : include ('header.php');
    : AdminLinks();
    : OpenTable3("90%");
    : echo "
    Access Denied!
    ";
    : echo "";
    : OpenTable("100%");
    : echo "
    Sorry! You are not authorized to perform this task.
    ";
    : echo "";
    : CloseTable();
    : CloseTable3();
    : include("footer.php");
    : }
    : ?>
    :
    ;-)
    -mac-
    mailto:mac_doggie@hotmail.com
    the Netherlands...


  • anyway,i have solve my problem.thanks anyway


    : Be more specific in your questions and don't just paste your whole application in the messageboard. Hint: Only paste those pieces of code you thing are the problem. Place [ code ] labels around it so your incrementations will display correct and maybe someone will actually look at your code and help you with your problem. I don't think many people are inspired to read ALL this great code you wrote when it isn't formatted in any way...
    :
    :
    : : i have problem with this coding below.when i select the month and year,it will display the first 50 records.then the next 50 records will display in the next page.the problem is when i click the next page,it wont display the next 50 records,it will just display no result found.this coding is wrriten by previous programmer and im having headache on his coding!anybody can help?
    : :
    : :
    : :
    : : <?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 .= "-----";
    : : for ($im=1; $im < 13 ; $im++){
    : : $select .= "".date("F", mktime(2, 0, 0, $im, 1, 2000) )."";
    : : }
    : : $select .= "";
    : :
    : : $select .= "";
    : : $year_end = date("Y") + 1;
    : : $select .= "----";
    : : for ($iy = 2000 ; $iy < $year_end; $iy++){
    : : $select .= "".$iy."";
    : : }
    : : $select .= "";
    : :
    : : return $select;
    : : }
    : :
    : : function menu($start_year,$start_month){
    : : global $mod_admin,$mod_title;
    : :
    : : echo "
    ".$mod_title."

    ";
    : : echo "";
    : : echo "";
    : : echo "";
    : : echo "
    ".select_date("start",$start_year,$start_month);
    : : echo "
    "
    : : .""
    : : .""
    : : ."
    ";
    : : echo "
    ";
    : : }
    : :
    : : function main($submitok,$start_year,$start_month){
    : : global $mod_admin,$db,$mainfile,$userdata,$mod_title;
    : : include ("header.php");
    : : AdminLinks();
    : :
    : : OpenTable3("96%");
    : : echo "
    ";
    : : 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 "";
    : : echo "";
    : : echo "";
    : : echo "";
    : :
    : : 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 "";
    : : }
    : : }
    : :
    : : echo "
    Activity Report
    DATEUSER IDACTIVITYIP ADDRESS
    ".date("d-M-Y",$row['date'])."".$username."".$act_title."".$row['ip']."
    ";
    : : // Gets the current records according to the current page
    : : echo "
    ";
    : : echo $pagination->prevpage("< Previous  
    ")
    : : ."Page: ".$pagination->page." of ".$pagination->pagecount.""
    : : ."  ".$pagination->nextpage("Next >")
    : : ."";
    : :
    : : // Gets the links for browsing
    : : echo "
    ";
    : : echo "
    ".$pagination->pagelinks("%page%", "%page%");
    : : echo "
    ";
    : : echo "

    ";
    : : echo "
    "
    : : ."";
    : : $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 "
    No result found
    ";
    : : echo "

    ";
    : : }
    : : CloseTable3();
    : : include ("footer.php");
    : : }
    : :
    : : switch($do){
    : : default:
    : : main($submitok,$start_year,$start_month);
    : : break;
    : : }
    : :
    : : } else {
    : : include ('header.php');
    : : AdminLinks();
    : : OpenTable3("90%");
    : : echo "
    Access Denied!
    ";
    : : echo "";
    : : OpenTable("100%");
    : : echo "
    Sorry! You are not authorized to perform this task.
    ";
    : : echo "";
    : : CloseTable();
    : : CloseTable3();
    : : include("footer.php");
    : : }
    : : ?>
    : :
    : ;-)
    : -mac-
    : mailto:mac_doggie@hotmail.com
    : the Netherlands...
    :
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories