hi,
page navigation is not working.please tell how to pass date
<?
include_once('session_control_emp_sp.php');
?>
<html>
<head></head>
<body>
<?
//db connection
$page_name="mg_resumep.php";
//$limit=sql_quote($_GET['limit']); // Read the limit value from query string.
$limit=$_GET['limit'];
//$start=sql_quote($_GET['start']); // To take care global variable if OFF
$start=$_GET['start'];
$id=$_GET['id'];
// echo "\n";
$agent=mysql_query("select * from magic_agent where id='$id'") or die("ERROR:".mysql_error());
while ($magic=mysql_fetch_array($agent))
{
$industry=$magic[2];
$industry1=$industry;
// $industry1=$industry&$careerlevel1=$careerlevel&$day1=$day
$careerlevel=$magic[3];
$careerlevel1=$careerlevel;
// echo $careerlevel;
// echo "\n";
$chkstate=$magic[4];
$day=$magic[6];
$day1=$day;
//echo $day1;
echo $industry1;
echo $careerlevel1;
echo $chkstate;
// echo "\n";
}
$empi=$_SESSION['employerid'];
$ours=mysql_query("SELECT group1 from cggroup where userid='$empi'")or die("ERROR:".mysql_error());
while ($our=mysql_fetch_row($ours))
{
echo "ours";
$gnam=$our[0];
$gname1=$gnam;
echo $gnam;
}
if(!($start > 0))
{ // This variable is set to zero for the first page
$start = 0;
}
$eu = ($start - 0);
if(!$limit > 0 )
{ // if limit value is not available then let us use a default value
$limit = 1; // No of records to be shown per page by default.
}
$this1 = $eu + $limit;
$back = $eu - $limit;
$next = $eu + $limit;
//*****************************************************************/
if($chkstate==0)
{
if($careerlevel==-1)
{
$result = mysql_query("SELECT post_resume.pid,post_resume.res_title, post_resume.candidate_type,
post_resume.ind_type, post_resume.career, post_resume.resume, post_resume.resume_upload, post_resume.groupn, login.id, login.username
FROM post_resume
INNER JOIN login ON post_resume.owner = login.id
WHERE ind_type = '$industry1'
&& groupn = '$gnam' && owner<>'$empi' && type='1' && tdate<='$day1' order by tdate limit $eu, $limit") or die("ERROR:".mysql_error());
}
else
{
$result = mysql_query("SELECT post_resume.pid,post_resume.res_title, post_resume.candidate_type,
post_resume.ind_type, post_resume.career, post_resume.resume, post_resume.resume_upload, post_resume.groupn, login.id, login.username
FROM post_resume
INNER JOIN login ON post_resume.owner = login.id
WHERE ind_type = '$industry1' && career='$careerlevel1'
&& groupn = '$gnam' && owner<>'$empi' && type='1' && tdate<='$day1' order by tdate limit $eu, $limit") or die("ERROR:".mysql_error());
}
}
else if($chkstate==1)
{
if($careerlevel==-1)
{
$result =mysql_query("SELECT post_resume.pid,post_resume.res_title, post_resume.candidate_type,
post_resume.ind_type, post_resume.career, post_resume.resume, post_resume.resume_upload, post_resume.groupn, login.id, login.username
FROM post_resume
INNER JOIN login ON post_resume.owner = login.id
WHERE ind_type = '$industry1'
&& groupn = '$gnam' && owner<>'$empi' && type='1' && tdate>'$day1' order by tdate limit $eu, $limit") or die("ERROR:".mysql_error());
}
else
{
$result = mysql_query("SELECT post_resume.pid,post_resume.res_title, post_resume.candidate_type,
post_resume.ind_type, post_resume.career, post_resume.resume, post_resume.resume_upload, post_resume.groupn, login.id, login.username
FROM post_resume
INNER JOIN login ON post_resume.owner = login.id
WHERE ind_type = '$industry1' && career='$careerlevel1'
&& groupn = '$gnam' && owner<>'$empi' && type='1' && tdate>'$day1' order by tdate limit $eu, $limit") or die("ERROR:".mysql_error());
}
}
else if($chkstate==2)
{
if($careerlevel==-1)
{
$result = mysql_query("SELECT post_resume.pid,post_resume.res_title, post_resume.candidate_type,
post_resume.ind_type, post_resume.career, post_resume.resume, post_resume.resume_upload, post_resume.groupn, login.id, login.username
FROM post_resume
INNER JOIN login ON post_resume.owner = login.id
WHERE ind_type = '$industry1'
&& groupn = '$gnam' && owner<>'$empi' && type='1' order by tdate limit $eu, $limit") or die("ERROR:".mysql_error());
}
else
{
$result = mysql_query("SELECT post_resume.pid,post_resume.res_title, post_resume.candidate_type,
post_resume.ind_type, post_resume.career, post_resume.resume, post_resume.resume_upload, post_resume.groupn, login.id, login.username
FROM post_resume
INNER JOIN login ON post_resume.owner = login.id
WHERE ind_type = '$industry1' && career='$careerlevel1'
&& groupn = '$gnam' && owner<>'$empi' && type='1' order by tdate limit $eu, $limit") or die("ERROR:".mysql_error());
}
}
else
{
}
//code for paging
if($chkstate==0)
{
if($careerlevel==-1)
{
$selcount = mysql_query("SELECT post_resume.pid,post_resume.res_title, post_resume.candidate_type,
post_resume.ind_type, post_resume.career, post_resume.resume, post_resume.resume_upload, post_resume.groupn, login.id, login.username
FROM post_resume
INNER JOIN login ON post_resume.owner = login.id
WHERE ind_type = '$industry1'
&& groupn = '$gnam' && owner<>'$empi' && type='1' && tdate<='$day1' order by tdate") or die("ERROR:".mysql_error());
echo "*";
}
else
{
$selcount = mysql_query("SELECT post_resume.pid,post_resume.res_title, post_resume.candidate_type,
post_resume.ind_type, post_resume.career, post_resume.resume, post_resume.resume_upload, post_resume.groupn, login.id, login.username
FROM post_resume
INNER JOIN login ON post_resume.owner = login.id
WHERE ind_type = '$industry1' && career='$careerlevel1'
&& groupn = '$gnam' && owner<>'$empi' && type='1' && tdate<='$day1' order by tdate") or die("ERROR:".mysql_error());
echo "**";
$nume=mysql_num_rows($selcount);
echo $nume;
}
}
else if($chkstate==1)
{
if($careerlevel==-1)
{
$selcount =mysql_query("SELECT post_resume.pid,post_resume.res_title, post_resume.candidate_type,
post_resume.ind_type, post_resume.career, post_resume.resume, post_resume.resume_upload, post_resume.groupn, login.id, login.username
FROM post_resume
INNER JOIN login ON post_resume.owner = login.id
WHERE ind_type = '$industry1'
&& groupn = '$gnam' && owner<>'$empi' && type='1' && tdate>'$day1' order by tdate") or die("ERROR:".mysql_error());
echo "***";
$nume=mysql_num_rows($selcount);
echo $nume;
}
else
{
$selcount = mysql_query("SELECT post_resume.pid,post_resume.res_title, post_resume.candidate_type,
post_resume.ind_type, post_resume.career, post_resume.resume, post_resume.resume_upload, post_resume.groupn, login.id, login.username
FROM post_resume
INNER JOIN login ON post_resume.owner = login.id
WHERE ind_type = '$industry1' && career='$careerlevel1'
&& groupn = '$gnam' && owner<>'$empi' && type='1' && tdate>'$day1' order by tdate") or die("ERROR:".mysql_error());
echo "****";
$nume=mysql_num_rows($selcount);
echo $nume;
}
}
else if($chkstate==2)
{
if($careerlevel==-1)
{
$selcount = mysql_query("SELECT post_resume.pid,post_resume.res_title, post_resume.candidate_type,
post_resume.ind_type, post_resume.career, post_resume.resume, post_resume.resume_upload, post_resume.groupn, login.id, login.username
FROM post_resume
INNER JOIN login ON post_resume.owner = login.id
WHERE ind_type = '$industry1'
&& groupn = '$gnam' && owner<>'$empi' && type='1' order by tdate") or die("ERROR:".mysql_error());
echo "*****";
$nume=mysql_num_rows($selcount);
echo $nume;
}
else
{
$selcount = mysql_query("SELECT post_resume.pid,post_resume.res_title, post_resume.candidate_type,
post_resume.ind_type, post_resume.career, post_resume.resume, post_resume.resume_upload, post_resume.groupn, login.id, login.username
FROM post_resume
INNER JOIN login ON post_resume.owner = login.id
WHERE ind_type = '$industry1' && career='$careerlevel1'
&& groupn = '$gnam' && owner<>'$empi' && type='1' order by tdate") or die("ERROR:".mysql_error());
echo "******";
$nume=mysql_num_rows($selcount);
echo $nume;
}
}
else
{
}
//$nume=mysql_num_rows($selcount);
//echo $nume;
echo "<table>";
//**************************************************************************
while($row = mysql_fetch_array($result))
{?>
<tr><td>
<?echo $row[0]; ?>
<td><?echo $row[1]?></td>
</tr>
<?
}
echo "</table>";
if($nume > $limit)
{
//Counting no of pages and the current page.
$totnumofpages = round($nume/$limit);
$i=0;
$l=1;
for($i=0;$i < $nume;$i=$i+$limit)
{
if($i == $eu)
{
$currentpage= $l;
}
$l=$l+1;
}
echo "<div height=28 align=right><table cellpadding=3 cellspacing=1 border=0 height=28><tr><td>Page ".$currentpage." / ".$totnumofpages."</td>";
//// if our variable $back is equal to 0 or more then only we will display the link to move back ////////
if($back >=0)
{
print "<td align='left'><a href='$page_name?start=$back&limit=$limit'><</a></td>";
}
//////////////// We will not display the current page as a link ///////////
$i=0;
$l=1;
for($i=0;$i < $nume;$i=$i+$limit)
{
if($i <> $eu)
{
echo "<td align=center><a href='$page_name?start=$i&limit=$limit&industry1=$industry&careerlevel1=$careerlevel&day1=$day&gname1=$gnam'><span>$l</span></a></td>";
}
else
{
echo "<td align=center><span><b>$l</b></span></td>";
} /// Current page is not displayed as link
$l=$l+1;
}
///////////// If we are not in the last page then Next link will be displayed. Here we check that /////
if($this1 < $nume)
{
print "<td align=center width=15><a href='$page_name?start=$next&limit=$limit&industry1=$industry&careerlevel1=$careerlevel&day1=$day&gname1=$gnam'><span ><b>></b></span></a></td>";
}
echo "</tr></table></div>";
}
mysql_close();
?>