Ik krijg telkens het zelfde vacature te zien...:S

Status
Niet open voor verdere reacties.

Genco

Gebruiker
Lid geworden
29 mei 2008
Berichten
28
Hallo allemaal,

Ik heb ooit met hulp een functie gemaakt waarbij men de mogelijkheid krijgt een vacature te wijzigen.

nu is het zo dat wanneer je op een vacature klikt met bijv. nr 40 je telkens nr 39 ziet.. Ik heb totaal geen idee waar de fout zit.

ik hoop dan ook dat jullie mij hiermee kunnen helpen.

Hieronder staat de codering...
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;
}
}

$currentPage = $_SERVER["PHP_SELF"];

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);

mysql_select_db($database_connect, $connect);
$query_gebruikers = "SELECT * FROM gebruikers WHERE gebruikers.status = 1";
$gebruikers = mysql_query($query_gebruikers, $connect) or die(mysql_error());
$row_gebruikers = mysql_fetch_assoc($gebruikers);
$totalRows_gebruikers = mysql_num_rows($gebruikers);

mysql_select_db($database_connect, $connect);
$query_contactpersoon = "SELECT * FROM contactpersoon WHERE contactpersoon.id ORDER BY contactpersoon.naam";
$contactpersoon = mysql_query($query_contactpersoon, $connect) or die(mysql_error());
$row_contactpersoon = mysql_fetch_assoc($contactpersoon);
$totalRows_contactpersoon = mysql_num_rows($contactpersoon);

mysql_select_db($database_connect, $connect);
$query_categorie = "SELECT * FROM categories WHERE categories.categorie_id ORDER BY categories.categorie_name";
$categorie = mysql_query($query_categorie, $connect) or die(mysql_error());
$row_categorie = mysql_fetch_assoc($categorie);
$totalRows_categorie = mysql_num_rows($categorie);

mysql_select_db($database_connect, $connect);
$query_contract = "SELECT * FROM contract WHERE contract.contract_id ORDER BY contract.contract_name";
$contract = mysql_query($query_contract, $connect) or die(mysql_error());
$row_contract = mysql_fetch_assoc($contract);
$totalRows_contract = mysql_num_rows($contract);

$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";
$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/detasourcestyle.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_lang">
<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="../php/source.php" target="_self">source</a></li>
      <li><a href="../php/vacatures.php" target="_self" id="selected">Vacatures</a></li>
      <li><a href="../php/contact_route.php" target="_self">Contact</a></li>
      <li><a href="#" target="_self" id="rightcorner">&nbsp;</a></li>
    </ul>
</div>
<div id="menu">
<div id="content4"></div>
</div>
<div class="content_vactures" id="content_vacatures">
  <h1 align="left" class="content1_h1">NIEUWE VACATURE TOEVOEGEN</h1>
  <p align="left" class="content1_h1"><input type="button" onmousedown="javascript:history.go(-1)" value="Terug">
  <table border="1" align="center">
    <tr>
      <td>id</td>
      <td>datum</td>
      <td>functie</td>
      <td>verwijderen</td>
      
    </tr>
    <?php do { ?>
    
      <tr>
        <td><a href="update_vacatures.php?recordID=<?php echo $row_vacatures['id']; ?>"><?php echo $row_vacatures['id']; ?></a></td>
        <td><a href="update_vacatures.php?recordID=<?php echo $row_vacatures['id']; ?>"><?php echo $row_vacatures['datum']; ?></a></td>
        <td><a href="update_vacatures.php?recordID=<?php echo $row_vacatures['id']; ?>"><?php echo $row_vacatures['functie']; ?></a></td>
        <td><a href="verwijderen_vacatures.php?ID=" . $row['id'] . "\">verwijder.
          <?php } while ($row_vacatures = mysql_fetch_assoc($vacatures)); ?>
  </table>
  <br />
  <table border="0">
    <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>
  Records <?php echo ($startRow_vacatures + 1) ?> to <?php echo min($startRow_vacatures + $maxRows_vacatures, $totalRows_vacatures) ?> of <?php echo $totalRows_vacatures ?>
  </p>
</div>
<div class="blok" id="topmenu2"></div>
<div class="bottummenu" id="bottummenu_laag">
<table class="bottummenu">
<tr>
	<td width="" height="20"><span class="style1">© 2008 by <?php echo $row_author['anaam']; ?> <?php echo $row_author['aachternaam']; ?></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;ab@source.nl?subject= ">EB</a></span></td>
    <td width="" height="20"><span class="style1">|</span></td>
    <td width="" height="20"><span class="style1">Telefoon: 06123456789</span></td>
</tr>
</table>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($author);

mysql_free_result($gebruikers);

mysql_free_result($contactpersoon);

mysql_free_result($categorie);

mysql_free_result($contract);

mysql_free_result($vacatures);

mysql_free_result($contact);
?>
 
Misschien is het raadzaam eerst je code eens op te schonen. Al die overbodige rotzooi eruit, je query's optimaliseren, etc.

Ik heb de code niet doorgekeken, maar ik kan je alvast vertellen dat deze site helemaal vastloopt als de bezoekersaantallen groeien.
 
Hey bedankt voor je reactie.

Ik heb totaal geen idee waar ik moet beginnen... meerdendeels heeft iemand anders het gemaakt, en nu moet ik zijn fouten lopen oplossen...
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan