New to mysql/php - how to display paged results with previous and next links
Below is code that I use now to diplay the results from a table. I would like to continue showing results newest first, but only 10 per page so the newest 10 on the first page then next 10 on the 2nd page, ect... Not sure what I may need to edit in this code?
Thank you for any help or suggestions that you can offer
Bernie
<?
include_once "control.php";
$day = date(d);
$month = date(m);
$year = date(Y);
$del = "delete from job_post where EXday = \"$day\" and EXmonth = \"$month\" and EXyear = \"$year\" ";
$rdel = mysql_query($del) or die(mysql_error());
if(!empty($job_del))
{
$q1 = "delete from job_post where job_id = \"$job_del\" and ename = \"$_SESSION[ename]\" ";
$r1 = mysql_query($q1) or die(mysql_error());
echo "<br><br><br><center><span class=HeaderClass>The selected job offer was deleted successfull.</span></center>";
}
else
{
$qm = "select * from job_post where ename = \"$_SESSION[ename]\" order by job_id";
$rqm = mysql_query($qm) or die(mysql_error());
if(mysql_num_rows($rqm) > '0')
{
echo "<br><table align=center border=1 bordercolor=993300 cellspacing=0 width=460>\n<caption align=center class=HeaderClass>Your current job offers</caption>\n";
while($aqm = mysql_fetch_array($rqm))
{
$day = date(d);
$month = date(m);
$year = date(Y);
$EXdate = "$aqm[EXyear]"."-"."$aqm[EXmonth]"."-"."$aqm[EXday]";
$dnes = "$year"."-"."$month"."-"."$day";
$qd = "select to_days('$EXdate') - to_days('$dnes')";
$rqd = mysql_query($qd) or die(mysql_error());
$adate = mysql_fetch_array($rqd);
$qempl = "select CompanyName, CompanyCountry, CompanyCity from job_employer_info where ename = \"$_SESSION[ename]\" ";
$rempl = mysql_query($qempl) or die(mysql_error());
$ae = mysql_fetch_array($rempl);
if($aqm[j_target] == '1')
{
$clname = 'Student (High School)';
}
elseif($aqm[j_target] == '2')
{
$clname = 'Student (undergraduate/graduate)';
}
elseif($aqm[j_target] == '3')
{
$clname = 'Entry Level (less than 2 years of experience)';
}
elseif($aqm[j_target] == '4')
{
$clname = 'Mid Career (2+ years of experience)';
}
elseif($aqm[j_target] == '5')
{
$clname = 'Management (Manager/Director of Staff)';
}
elseif($aqm[j_target] == '6')
{
$clname = 'Executive (SVP, EVP, VP)';
}
elseif($aqm[j_target] == '7')
{
$clname = 'Senior Executive (President, CEO)';
}
elseif($aqm[j_target] == '8')
{
$clname = 'Full Time, Employee';
}
elseif($aqm[j_target] == '9')
{
$clname = 'Part Time, Employee';
}
elseif($aqm[j_target] == '10')
{
$clname = 'Contract';
}
elseif($aqm[j_target] == '11')
{
$clname = 'Temporary/Contract/Project';
}
$show_category = str_replace("|", ", ", $aqm[JobCategory]);
$show_description = nl2br($aqm[description]);
echo "<tr>
<td class=BlackText>
<b>Job ID: </b> $aqm[job_id] (<a href=\"EditJob.php?job_ed=$aqm[job_id]\" class=GreenLink>edit</a> | <a href=\"managejobs.php?job_del=$aqm[job_id]\" class=TNA OnClick=\"return cdel('job offer');\">delete</a>)<br>
<b>Position:</b> $aqm[position] <br>
<b>Deascription: </b><br>$show_description<br>
<b>Salary: </b> $aqm[salary] / $aqm[s_period]<br>
<b>Job category: </b> $show_category <br>
<b>Target: </b> $clname <br>
<b>The job expire after: </b> $adate[0] day(s)<br>
<b>Country</b> $aqm[CompanyCountry]<br>
view <a href=\"ManageAplicants.php?job_id=$aqm[job_id]&job_id=$aqm[job_id]&position=$aqm[position]\" class=TNA> aplicants list</a> for this position
</td>
</tr>
";
}
echo "</table>";
}
else
{
echo "<center><span class=\"BlackLink\">Click <a href=\"PostJob.php\" class=TNA>here</a> to post your first job offer!</span>";
}
}
?>
<? include_once('../copyright.php'); ?>
Subject
Written By
Posted
New to mysql/php - how to display paged results with previous and next links
June 09, 2005 01:25PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.