Papa Paging
Posted: Fri Dec 19, 2008 5:34 am
Hello Everyone,
Sorry Papa but I told you I would have another problem
Basically a database of information and a php page that displayes specific result which again, is easy enough. But what I want to do is use paging, so that I can specify the amount of records to be displayed per page.
Here is the code for my page the pulls across the data from MySql and displayes it:
On top of that, once you click on a particular job, it displayes the job pulling across even more infromation from mysql (to be more specific to the suer about the job that they are intersted in)
What I would like to be able to do is, once a user clisk on a job and gets the above mentioned "more specific" information, I want to add an 'apply' linke that brings up a webform which pulls the correct ID and Job title into itself before requesting more details from the user.
Job List --> Select a job --> apply --> send off the details of your application
HALP!
Sorry Papa but I told you I would have another problem
Basically a database of information and a php page that displayes specific result which again, is easy enough. But what I want to do is use paging, so that I can specify the amount of records to be displayed per page.
Here is the code for my page the pulls across the data from MySql and displayes it:
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="vacancy_style.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
//Run a query to select the data from the db, then organise it by id
$query = "SELECT id, jobtitle, jobtype, area, salary, qualifications, skills, jobdescription FROM jobpost ORDER BY id";
$result = mysql_query($query) or die('Error : ' . mysql_error());
?>
<table width="53%" border="0" align="center" cellpadding="10" cellspacing="0">
<tr align="center" bgcolor="#666666">
<td width="116"><h1 align="left">Job Title</h1></td>
<td width="191"><h1 align="left">Area</h1></td>
<td width="140"><h1 align="left">Ref:</h1></td>
<td width="117"><h1 align="left">Job Type</h1></td>
</tr>
<?php
while(list($id, $jobtitle, $jobtype, $area, $salary, $qualifications, $skills, $jobdescription) = mysql_fetch_array($result, MYSQL_NUM))
{
?>
<tr class="btnav" onMouseOver="style.backgroundColor='#d8d8d8';" onMouseOut="style.backgroundColor='transparent'">
<td width="116" align="centre" ><p><a href="jobspecific.php?id=<?php echo $id;?>" target="_self" class="one"><?php echo $jobtitle;?></p></td>
<td width="191" align="center"><p align="left"><?php echo $area;?></p></td>
<td width="140" align="center"><p align="left">JOB00SH<?php echo $id;?></p></td>
<td width="117" align="center"><p align="left"><?php echo $jobtype;?></p></td>
</tr>
<?php } include 'library/closedb.php'; ?>
</table>
</body>
</html>Code: Select all
<?php
include 'library/config.php';
include 'library/opendb.php';
// If no id is specified, list the available jobs
if(!isset($_GET['id']))
{
$self = $_SERVER['PHP_SELF'];
//The data we will be talking to.
$query = "SELECT id, jobtitle, jobtype, area, salary, qualifications, skills, jobdescription FROM jobpost ORDER BY id";
$result = mysql_query($query) or die('Error : ' . mysql_error());
// create the job list
while($row = mysql_fetch_array($result, MYSQL_NUM))
{
//defines what data pull should be displayed in the table.
list($id, $jobtitle, $jobtype, $area, $salary, $qualifications, $skills, $jobdescription) = $row;
$content .= "<li><a href=\"$self?id=$id\">$jobtitle</a></li>\r\n";
}
$title = 'Jobs';
} else {
// Pull the jobs from the database
$query = "SELECT jobtitle, jobtype, area, jobdescription, salary, qualifications, skills FROM jobpost WHERE id=".$_GET['id'];
$result = mysql_query($query) or die('Error : ' . mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC);
//Jobs to list
$jobtitle = $row['jobtitle'];
$jobtype = $row['jobtype'];
$area = $row['area'];
$salary = $row['salary'];
$qualifications = $row['qualifications'];
$skills = $row['skills'];
$jobdescription = $row['jobdescription'];
}
include 'library/closedb.php';
?>
<html>
<head>
<title>
<?php echo $title;?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="vacancy_style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" align="left" cellpadding="10" cellspacing="0">
<table width="490" border="0" cellpadding="1" cellspacing="5" id="VacancyForm">
<tr>
<td width="146"> </td>
<td width="321"> </td>
</tr>
<tr>
<td colspan="2"><h1><?php echo $jobtitle; ?></h1></td>
</tr>
<tr>
<td> </td>
<td>JOB00SH<?php echo $id; ?></td>
</tr>
<tr>
<td bgcolor="#666666">Job Title:</td>
<td><?php echo $jobtitle; ?></td>
</tr>
<tr>
<td bgcolor="#666666">Job Type:</td>
<td><?php echo $jobtype; ?></td>
</tr>
<tr>
<td bgcolor="#666666">Area:</td>
<td><?php echo $area; ?></td>
</tr>
<tr>
<td bgcolor="#666666">Salary:</td>
<td><?php echo $salary; ?></td>
</tr>
<tr>
<td bgcolor="#666666">Qualifications:</td>
<td><?php echo $qualifications; ?></td>
</tr>
<tr>
<td bgcolor="#666666">Skills:</td>
<td><?php echo $skills; ?></td>
</tr>
<tr>
<td bgcolor="#666666">Job Description</td>
<td><?php echo $jobdescription; if(isset($_GET['id'])) { ?><?php } ?></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td><p align="justify"><a href="jobsposted.php">Job List</a></p>
<p align="justify"> </p>
<p align="justify"><a href="apply.php?id=<?php echo $id;?><br><?php echo $jobtitle;?>" target="_self" class="one">apply</p></td>
</tr>
</table>
</body>
</html>Job List --> Select a job --> apply --> send off the details of your application