Tabel waarmee men kan filteren.

  • Onderwerp starter Onderwerp starter Genco
  • Startdatum Startdatum
Status
Niet open voor verdere reacties.

Genco

Gebruiker
Lid geworden
29 mei 2008
Berichten
28
Hi,

Ik heb een pagina met vacatures erop. Het is de bedoeling dat men door middel van een tabel de gewenste vacatures kan zien.

Dus als je kiest op bijv. ict dat je alleen maar ict vacatures ziet..

de categorieën staan al in de database, het is een kwestie van een scriptje..

de categorieën zijn:
categorie_id categorie_name
1 Information Technology
2 Banken & Verzekeringen
3 Finance
4 Algemeen
PHP:
<?php require_once('../connections/connect.php'); ?><?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;
}
}

mysql_select_db($database_connect, $connect);
$query_contact = "SELECT * FROM contact";
$contact = mysql_query($query_contact, $connect) or die(mysql_error());
$row_contact = mysql_fetch_assoc($contact);
$totalRows_contact = mysql_num_rows($contact);

mysql_select_db($database_connect, $connect);
$query_author = "SELECT author.anaam, author.aachternaam, author.aemail FROM author";
$author = mysql_query($query_author, $connect) or die(mysql_error());
$row_author = mysql_fetch_assoc($author);
$totalRows_author = mysql_num_rows($author);

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_vacatures = 10;
$pageNum_vacatures = 0;
if (isset($_GET['pageNum_vacatures'])) {
  $pageNum_vacatures = $_GET['pageNum_vacatures'];
}
$startRow_vacatures = $pageNum_vacatures * $maxRows_vacatures;

mysql_select_db($database_connect, $connect);
$query_vacatures = "SELECT * FROM vacatures ORDER BY vacatures.datum DESC";
$query_limit_vacatures = sprintf("%s LIMIT %d, %d", $query_vacatures, $startRow_vacatures, $maxRows_vacatures);
$vacatures = mysql_query($query_limit_vacatures, $connect) or die(mysql_error());
$row_vacatures = mysql_fetch_assoc($vacatures);

if (isset($_GET['totalRows_vacatures'])) {
  $totalRows_vacatures = $_GET['totalRows_vacatures'];
} else {
  $all_vacatures = mysql_query($query_vacatures);
  $totalRows_vacatures = mysql_num_rows($all_vacatures);
}
$totalPages_vacatures = ceil($totalRows_vacatures/$maxRows_vacatures)-1;

$queryString_vacatures = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_vacatures") == false && 
        stristr($param, "totalRows_vacatures") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_vacatures = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_vacatures = sprintf("&totalRows_vacatures=%d%s", $totalRows_vacatures, $queryString_vacatures);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Detasource - flexible solutions</title>
<link href="../css/sourcestyle.css" rel="stylesheet" type="text/css" />

<script src="../scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
.style1 {font-weight: bold}
.style2 {color: #000000}
-->
</style>
</head>

<body>
<div class="body" id="wrapper">
<div class="blok" id="topmenu1"></div>
<div id="logo"></div>
<div id="pointermenu">
    <ul>
     <li><a href="../index.php" target="_self">Home</a></li>
      <li><a href="source.php" target="_self">source</a></li>
      <li><a href="vacatures.php" target="_self" id="selected">Vacatures</a></li>
      <li><a href="contact_route.php" target="_self">Contact</a></li>
      <li><a href="medewerkers.php" target="_self">Medewerkers</a></li>
      <li><a href="#" target="_self" id="rightcorner">&nbsp;</a></li>
    </ul>
</div>
<div id="menu">
<div id="content4"></div>
</div>
<div id="hoofdimg"></div>
<div class="content_vactures" id="content_inloggen">
  <h1 align="left" class="content1_h1">VACATURES</h1>
  <p><table align="center">
  <tr>
    <td><div align="left">Datum</div></td>
    <td><div align="left"></div></td>
    <td><div align="left">Vacaturenummer</div></td>
    <td><div align="left"></div></td>
    <td><div align="left"></div></td>
    <td><div align="left">Functie</div></td>
    <td><div align="left"></div></td>
    <td><div align="left">Plaats</div></td>
    <td><div align="left"></div></td>
    <td><div align="left">Contract</div></td>
  </tr>
  <?php do { ?>
    <tr>
      <td><div align="left"><a href="details_vacatures.php?recordID=<?php echo $row_vacatures['id']; ?>"><?php echo $row_vacatures['datum']; ?></a></div></td>
      <td><div align="left"></div></td>
      <td><div align="center"><a href="details_vacatures.php?recordID=<?php echo $row_vacatures['id']; ?>"><?php echo $row_vacatures['id']; ?></a></div></td>
      <td><div align="left"></div></td>      
      <td><div align="left"></div></td>
      <td><div align="left"><a href="details_vacatures.php?recordID=<?php echo $row_vacatures['id']; ?>"><?php echo $row_vacatures['functie']; ?></a></div></td>
      <td><div align="left"></div></td>
      <td><div align="left"><a href="details_vacatures.php?recordID=<?php echo $row_vacatures['id']; ?>"><?php echo $row_vacatures['plaats']; ?></a></div></td>
      <td><div align="left"></div></td>
      <td><div align="left"><a href="details_vacatures.php?recordID=<?php echo $row_vacatures['id']; ?>"><?php echo $row_vacatures['contract']; ?></a></div></td>
    </tr>
    <?php } while ($row_vacatures = mysql_fetch_assoc($vacatures)); ?>
</table>
<br />
<table border="0" align="center">
  <tr>
    <td><?php if ($pageNum_vacatures > 0) { // Show if not first page ?>
          <a href="<?php printf("%s?pageNum_vacatures=%d%s", $currentPage, 0, $queryString_vacatures); ?>">First</a>
          <?php } // Show if not first page ?>    </td>
    <td><?php if ($pageNum_vacatures > 0) { // Show if not first page ?>
          <a href="<?php printf("%s?pageNum_vacatures=%d%s", $currentPage, max(0, $pageNum_vacatures - 1), $queryString_vacatures); ?>">Previous</a>
          <?php } // Show if not first page ?>    </td>
    <td><?php if ($pageNum_vacatures < $totalPages_vacatures) { // Show if not last page ?>
          <a href="<?php printf("%s?pageNum_vacatures=%d%s", $currentPage, min($totalPages_vacatures, $pageNum_vacatures + 1), $queryString_vacatures); ?>">Next</a>
          <?php } // Show if not last page ?>    </td>
    <td><?php if ($pageNum_vacatures < $totalPages_vacatures) { // Show if not last page ?>
          <a href="<?php printf("%s?pageNum_vacatures=%d%s", $currentPage, $totalPages_vacatures, $queryString_vacatures); ?>">Last</a>
          <?php } // Show if not last page ?>    </td>
  </tr>
</table>
<div align="center">Aantal vacatures <?php echo ($startRow_vacatures + 1) ?> to <?php echo min($startRow_vacatures + $maxRows_vacatures, $totalRows_vacatures) ?> of <?php echo $totalRows_vacatures ?>
    </p>
</div>
</div>
<div class="bottummenu" id="bottummenu">
<table class="bottummenu">
<tr>
	<td width="" height="20"><span class="style1">© 2008 by<u> source</u></span></td>
    <td width="" height="20"><span class="style1">|</span></td>
    <td width="" height="20"><span class="style1">E-mail: <a 
      href="mailto:info@source.nl;bk@source.nl?subject= Info source">Piet Paulusma</a></span></td>
    <td width="" height="20"><span class="style1">|</span></td>
    <td width="" height="20"><span class="style1">Telefoon: +31 (0) </span></td>
</tr>
</table>
</div>
<div class="blok" id="topmenu2"></div>
</div>
</body>
</html>
<?php
mysql_free_result($author);

mysql_free_result($contact);

mysql_free_result($vacatures);
?>
 
Laatst bewerkt:
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan