Forums

This topic is locked

page navigation problem

Posted 24 Jun 2007 08:21:38
1
has voted
24 Jun 2007 08:21:38 amit MR posted:
I am having the page navigation problem,, all the code below are fine but when the NEXT and PREVIOUS button is pressed it shows the inital search page not the other data listed in the database,, if I delete the session and other search button isset feature , the naviagation works ,, why so ,, can some one suggest??<b></b><b></b>

&lt;?php require_once('Connections/kmaile.php'); ?&gt;
&lt;?php

//initialize the session
session_start();
$a=rand();

if(isset($_SESSION['user']))
{
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")
{
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")
{
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['user'] = NULL;
$_SESSION['verifyuser'] = NULL;
unset($_SESSION['user']);
unset($_SESSION['verifyuser']);

$logoutGoTo = "login.php";
if ($logoutGoTo)
{
header("Location: $logoutGoTo";
exit;
}
}


?&gt;
&lt;?php
if (!function_exists("GetSQLValueString")
{
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string" ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "" ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "" ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "" ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "" ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "" ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
//(isset($_POST['text1']))
if ((isset($_SERVER['QUERY_STRING'])) && (@$_POST['text1']!="")
{


$query1=@$_POST['text1'];

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_Recordset1 = 1000;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_kmaile, $kmaile);
$query_Recordset1 = "SELECT * FROM org_tab WHERE org_tab.Fname LIKE '%" .$query1. "%' OR org_tab.Lname LIKE '%" .$query1. "%' ORDER BY org_tab.Fname";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $kmaile) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1" == false &&
stristr($param, "totalRows_Recordset1" == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;link href="logtable.css" rel="stylesheet" type="text/css" /&gt;

&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;style type="text/css"&gt;
&lt;!--
.style1 {
color: #FFFFFF;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
a:link {
color: #000000;
}
a:visited {
color: #cccccc;
}
a:active {
color: #009999;
}
--&gt;
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;table width="741" height="121" border="0" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;th width="737" height="98" scope="col"&gt;COLLEGE HEADER &lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td background="images/top.gif" height="10"&gt;&nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td background="images/top_2.gif" height="9"&gt;&lt;div align="justify" class="style1"&gt;
&lt;div align="center"&gt;
&lt;p&gt;&lt;a href="register1.php?ref=&lt;?php echo $a; ?&gt;"&gt; Add Member &lt;/a&gt;&nbsp;&nbsp;&nbsp;| &nbsp;&nbsp; List &nbsp;&nbsp;&nbsp;| &nbsp;&nbsp;Change Password &nbsp;&nbsp;&nbsp;| &nbsp;&nbsp;&lt;a href="&lt;?php echo $logoutAction ?&gt;"&gt;Logout&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;&lt;P&gt;
&lt;?php
function processRow($count)
{
switch(intval($count))
{
case 1:
{
$color="#cccccc";
break;
}
case 2:
{
$color="#b9b9b9";
break;
}
default:
$color="#ffffff";
}
return $color;
}
?&gt;

&lt;table width="635" height="94" border="1"&gt;
&lt;tr&gt;
&lt;th scope="col" colspan="12" height="12"&gt;&lt;form name="se" action="&lt;?php $_SERVER['PHP_SELF']; ?&gt;" method="POST"&gt;Search Member:
&lt;input type="text" name="text1"&gt; &nbsp;&lt;input type="submit" name="Submit" value="Search"&gt;&lt;/form&gt;&lt;/th&gt;
&lt;th scope="col" colspan="3"&gt;&lt;a href="&lt;?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?&gt;"&gt;Next&lt;/a&gt; &lt;a href="&lt;?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?&gt;"&gt;dfmkm&lt;/a&gt;&lt;/th&gt;

&lt;/tr&gt;
&lt;tr&gt;
&lt;th height="8"&gt;khecID&lt;/th&gt;
&lt;th width="50"&gt;Fname&lt;/th&gt;
&lt;th width="50"&gt;Mname&lt;/th&gt;
&lt;th width="60"&gt;Lname&lt;/th&gt;
&lt;th width="5"&gt;sex&lt;/th&gt;
&lt;th width="90"&gt;Faculty&lt;/th&gt;
&lt;th width="90"&gt;CuAdd&lt;/th&gt;
&lt;th width="25"&gt;ConPH&lt;/th&gt;
&lt;th width="25"&gt;ConMOB&lt;/th&gt;
&lt;th width="50"&gt;altemail&lt;/th&gt;
&lt;th width="50"&gt;ACcret&lt;/th&gt;
&lt;th width="50"&gt;ACexp&lt;/th&gt;
&lt;th width="30"&gt;Usern&lt;/th&gt;
&lt;th colspan=2&gt;update&lt;/th&gt;
&lt;/tr&gt;

&lt;?php
$count=0;
do {
if($count&gt;=2)
{
$count=0;
}

$count= $count+1;
?&gt;
&lt;tr bgcolor="&lt;?php echo processRow($count); ?&gt;"&gt;
&lt;td &gt;&lt;?php echo $row_Recordset1['khecID']; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $row_Recordset1['Fname']; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $row_Recordset1['Mname']; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $row_Recordset1['Lname']; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $row_Recordset1['sex']; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $row_Recordset1['Faculty']; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $row_Recordset1['CuAdd']; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $row_Recordset1['ConPH']; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $row_Recordset1['ConMOB']; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $row_Recordset1['altemail']; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $row_Recordset1['ACcret']; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $row_Recordset1['ACexp']; ?&gt;&lt;/td&gt;
&lt;td&gt;&lt;?php echo $row_Recordset1['Usern']; ?&gt;&lt;/td&gt;
&lt;td width="4%"&gt;&lt;a href="update_usere.php?id=&lt;?php print ($row_Recordset1['khecID']);?&gt;"&gt; Edit&lt;/a&gt;&lt;/td&gt;
&lt;td width="6%"&gt;&lt;a href="userdele.php?id=&lt;?php print ($row_Recordset1['khecID']);?&gt;"&gt;Delete&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?&gt;
&lt;/table&gt;

&lt;p&gt;&nbsp;&lt;/p&gt;
&lt;table width="739" height="22" border="1" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td bgcolor=""&gt;Copy right information&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;?php
mysql_free_result($Recordset1);
}
else{
?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;link href="logtable.css" rel="stylesheet" type="text/css" /&gt;

&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;style type="text/css"&gt;
&lt;!--
.style1 {
color: #FFFFFF;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
a:link {
color: #000000;
}
a:visited {
color: #cccccc;
}
a:active {
color: #009999;
}
--&gt;
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;table width="741" height="121" border="0" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;th width="737" height="98" scope="col"&gt;COLLEGE HEADER &lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td background="images/top.gif" height="10"&gt;&nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td background="images/top_2.gif" height="9"&gt;&lt;div align="justify" class="style1"&gt;
&lt;div align="center"&gt;
&lt;p&gt;&lt;a href="register1.php?ref=&lt;?php echo $a; ?&gt;"&gt; Add Member &lt;/a&gt;&nbsp;&nbsp;&nbsp;| &nbsp;&nbsp; List &nbsp;&nbsp;&nbsp;| &nbsp;&nbsp;Change Password &nbsp;&nbsp;&nbsp;| &nbsp;&nbsp;&lt;a href="&lt;?php echo $logoutAction ?&gt;"&gt;Logout&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;&lt;P&gt;


&lt;table width="635" height="94" border="1"&gt;
&lt;tr&gt;
&lt;th scope="col" colspan="12" height="12"&gt;&lt;form name="se" action="&lt;?php $_SERVER['PHP_SELF']; ?&gt;" method="POST"&gt;Search Member:
&lt;input type="text" name="text1"&gt; &nbsp;&lt;input type="submit" name="Submit" value="Search"&gt;&lt;/form&gt;&lt;/th&gt;


&lt;/tr&gt;



&lt;/table&gt;&lt;p&gt;&nbsp;&lt;/p&gt;
&lt;table width="739" height="22" border="1" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td bgcolor=""&gt;Copy right information&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;?php
}

}
else //session user
{
echo "&lt;script language='JavaScript'&gt;";
echo "window.alert('Error! Login, You are not authorized user')";
echo "&lt;/script&gt;";
//header("location: login1.php";
include ('login.php');
}
?&gt;

Reply to this topic