Paging
Posted: Mon Dec 22, 2008 8:55 am
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
ello guys,
I wrote this simple php page that takes the data entries from a mysql database and then displays them as links in a table. These links can then be clicked on to show more specific information about each job. I want to expand my page by allowing paging through the records. Does anyone know the best way to apply paging to my code?
Help is, as ever, appreciated.
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
ello guys,
I wrote this simple php page that takes the data entries from a mysql database and then displays them as links in a table. These links can then be clicked on to show more specific information about each job. I want to expand my page by allowing paging through the records. Does anyone know the best way to apply paging to my code?
Help is, as ever, appreciated.
Code: Select all
<?php
include 'configuration.php';
include 'opendatabase.php';
?>
<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());
?>
<p> </p>
<table width="668" border="0" cellpadding="5" cellspacing="5" id="JobBase">
<tr>
<td width="547" valign="top"><table width="490" border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#fafafa" class="tblb" id="Jobs">
<tr align="center" bgcolor="#dbdbdb">
<td width="145"><h2 align="left">Job Title</h2></td>
<td width="92"><h2 align="left">Area</h2></td>
<td width="94"><h2 align="left">Ref:</h2></td>
<td width="92"><h2 align="left">Job Type</h2></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="145" align="centre" ><p><a href="jobspecific.php?id=<?php echo $id;?>" target="_self" class="one"><?php echo $jobtitle;?></p></td>
<td width="92" align="center"><p align="left"><?php echo $area;?></p></td>
<td width="94" align="center"><p align="left">JOB00SH<?php echo $id;?></p></td>
<td width="92" align="center"><p align="left"><?php echo $jobtype;?></p></td>
</tr>
<?php } include 'library/closedb.php'; ?>
</table></td>
<td width="86" valign="top"><table width="91" border="0" cellpadding="5" cellspacing="0" id="Navigation">
<tr>
<td width="81"><a href="post_vacancy.php" class="one">Post Job</a></td>
</tr>
<tr>
<td><a href="jobsposted.php" class="one">View Jobs</a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
</tr>
</table>
<p> </p>
</body>
</html>~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: