All the code at the top of the page currently looks like :
<?php require_once('../Connections/connSearchTechUK.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
$queryString_Candidates = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Candidates = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Candidates = sprintf("&totalRows_Candidates=%d%s", $totalRows_Candidates, $queryString_Candidates);
$TFM_LimitLinksEndCount = 5;
$TFM_temp = $pageNum_Candidates + 1;
$TFM_startLink = max(1,$TFM_temp - intval($TFM_LimitLinksEndCount/2));
$TFM_temp = $TFM_startLink + $TFM_LimitLinksEndCount - 1;
$TFM_endLink = min($TFM_temp, $totalPages_Recordset1 + 1);
if($TFM_endLink != $TFM_temp) $TFM_startLink = max(1,$TFM_endLink - $TFM_LimitLinksEndCount + 1);
//db session
mysql_select_db($database_connSearchTechUK, $connSearchTechUK);
if (isset($_POST['profiles'])){
// get profile keys
$profiles = array_keys($_POST['profiles']);
// sql string
$sql = 'SELECT *, Count(*) As rank FROM Candidates, CandidateProfiles WHERE Candidates.CandidateID =
CandidateProfiles.CandidateID AND CandidateProfiles.ProfileID IN(' . implode(',', $profiles).') GROUP BY
Candidates.CandidateID ORDER BY rank DESC, Candidates.CandidateID';
$Candidates = mysql_query($sql) or die(mysql_error());
$row_Candidates = mysql_fetch_assoc($Candidates);
@$totalRows = mysql_num_rows($Candidates);
}
else
{
echo 'You did not check any profiles';
}
?>