BElow is my php code for candidate search, it have 4 criteria which is academic background, functional experience, preferred location and languages ability. but it show yhe blanks page..
Emm, is it becase of the languages ability is at checkbox, so cannot display the profile...
Can someone give me a guildeline... Thanks..
[PHP]<?php
//required file for database connection
include("config.php");
if (isset($_POST['aBackground'])) {
$aBackground = mysql_real_escape_string($_POST["aBackground"]);
$fExperience = mysql_real_escape_string($_POST["fExperience"]);
$pLocation = $_POST["pLocation"];
$lAbility = $_POST["lAbility"];
$sql = "SELECT * FROM resume";
$string1 = array();
$where1 = "";
if (isset($_POST["aBackground"]) AND !empty($_POST["aBackground"]))
$string1[] = " aBackground LIKE '%".$_POST["aBackground"]."%' ";
if (isset($_POST["fExperience"]) AND !empty($_POST["fExperience"]))
$string1[] = " fExperience LIKE '%".$_POST["fExperience"]."%' ";
if (isset($_POST["pLocation"]) AND !empty($_POST["pLocation"]))
$string1[] = " pLocation LIKE '%".$_POST["pLocation"]."%' ";
if (isset($_POST["lAbility"]) AND !empty($_POST["lAbility"]))
$string1[] = " lAbility LIKE '%".$_POST["lAbility"]."%' ";
if (!empty($string1))
$where1 = " WHERE ".implode("AND", $string1);// OR/AND
$sql1="SELECT * FROM resume $where1";
$string2 = array();
$where2 = "";
if (isset($_POST["aBackground"]) AND !empty($_POST["aBackground"]))
$string2[] = " aBackground LIKE '%".$_POST["aBackground"]."%' ";
if (isset($_POST["fExperience"]) AND !empty($_POST["fExperience"]))
$string2[] = " fExperience LIKE '%".$_POST["fExperience"]."%' ";
if (isset($_POST["pLocation"]) AND !empty($_POST["pLocation"]))
$string2[] = " pLocation LIKE '%".$_POST["pLocation"]."%' ";
if (!empty($string2))
$where2 = " WHERE ".implode("AND", $string2);// OR/AND
$sql2="SELECT * FROM resume $where2";
$string3 = array();
$where3 = "";
if (isset($_POST["aBackground"]) AND !empty($_POST["aBackground"]))
$string3[] = " aBackground LIKE '%".$_POST["aBackground"]."%' ";
if (isset($_POST["fExperience"]) AND !empty($_POST["fExperience"]))
$string3[] = " fExperience LIKE '%".$_POST["fExperience"]."%' ";
if (isset($_POST["lAbility"]) AND !empty($_POST["lAbility"]))
$string3[] = " lAbility LIKE '%".$_POST["lAbility"]."%' ";
if (!empty($string3))
$where3 = " WHERE ".implode("AND", $string3);// OR/AND
$sql3="SELECT * FROM resume $where3";
$string4 = array();
$where4 = "";
if (isset($_POST["aBackground"]) AND !empty($_POST["aBackground"]))
$string4[] = " aBackground LIKE '%".$_POST["aBackground"]."%' ";
if (isset($_POST["pLocation"]) AND !empty($_POST["pLocation"]))
$string4[] = " pLocation LIKE '%".$_POST["pLocation"]."%' ";
if (isset($_POST["lAbility"]) AND !empty($_POST["lAbility"]))
$string4[] = " lAbility LIKE '%".$_POST["lAbility"]."%' ";
if (!empty($string4))
$where4 = " WHERE ".implode("AND", $string4);// OR/AND
$sql4="SELECT * FROM resume $where4";
$string5 = array();
$where5 = "";
if (isset($_POST["fExperience"]) AND !empty($_POST["fExperience"]))
$string5[] = " fExperience LIKE '%".$_POST["fExperience"]."%' ";
if (isset($_POST["pLocation"]) AND !empty($_POST["pLocation"]))
$string5[] = " pLocation LIKE '%".$_POST["pLocation"]."%' ";
if (isset($_POST["lAbility"]) AND !empty($_POST["lAbility"]))
$string5[] = " lAbility LIKE '%".$_POST["lAbility"]."%' ";
if (!empty($string5))
$where5 = " WHERE ".implode("AND", $string5);// OR/AND
$sql5="SELECT * FROM resume $where5";
// Call for this $sql
if ($aBackground== ""&&$fExperience==""&&$pLocation==""&&$lAbility="" ){
$data = mysql_query($sql)
or die("Cannot execute query");
}
elseif(!empty($aBackground)&&!empty($fExperience)& &!empty($pLocation)&&!empty($lAbility)){
$data = mysql_query($sql1)
or die("Cannot execute query");
}
elseif(!empty($aBackground)&&!empty($fExperience)& &!empty($pLocation)){
$data = mysql_query($sql2)
or die("Cannot execute query");
}
elseif(!empty($aBackground)&&!empty($fExperience)& &!empty($lAbility)){
$data = mysql_query($sql3)
or die("Cannot execute query");
}
elseif(!empty($aBackground)&&!empty($pLocation)&&! empty($lAbility)){
$data = mysql_query($sql4)
or die("Cannot execute query");
}
elseif(!empty($fExperience)&&!empty($pLocation)&&! empty($lAbility)){
$data = mysql_query($sql5)
or die("Cannot execute query");
}
?>
<?php
$anymatches = mysql_num_rows($data);
if ($anymatches == 0){
$message=" <img src='image/sorry.gif'>".
"<font face='Verdana' size='2'> Sorry, your search returned 0 results.<br>";
include("candidateSearch.php");
exit();
}
?>
<?php
$bgcolor="#ccccff";
?>
<p align=center><center><font face='Verdana' size='3'><strong>Search Results</strong></p>
<table border='1'align=center>
<TABLE width=100% height="43" align=center cellpadding=0 cellspacing=0> <tr>
<td bgcolor='9999ff' > <font face='Verdana' color='#000000' size='3'>Resume ID</font></td>
<td bgcolor='9999ff' > <font face='Verdana' color='#000000' size='3'>Academic Background</font></td>
<td bgcolor='9999ff' > <font face='Verdana' color='#000000' size='3'>Functional Experience</font></td>
<td bgcolor='9999ff' > <font face='Verdana' color='#000000' size='3'>Preferred Location</font></td>
<td bgcolor='9999ff' > <font face='Verdana' color='#000000' size='3'>Languages Ability</font></td></tr>
</tr>
<?php
$counter = 0;
while($result = mysql_fetch_array( $data )){
if ($counter == 3) {
$counter = 0;
}
if($bgcolor=='#ccccff'){$bgcolor='#ffffff';}
else{$bgcolor='#ccccff';}
echo"
<tr><td align=left bgcolor=$bgcolor><a href='candidateSearch_result.php?id={$result['resume_ID']}'> <font face='Verdana' size='2'>{$result['resume_ID']}</a></td>
<td align=left bgcolor=$bgcolor> <font face='Verdana' size='2'>{$result['aBackground']}</td>
<td align=left bgcolor=$bgcolor> <font face='Verdana' size='2'>{$result['fExperience']}</td>
<td align=left bgcolor=$bgcolor> <font face='Verdana' size='2'>{$result['pLocation']}</td>
<td align=left bgcolor=$bgcolor> <font face='Verdana' size='2'>{$result['lAbility']}</td>
</tr>";
$counter = $counter + 1;
}
?>
</table>
<br><br><br><a href='candidateSearch.php? '><font face='Verdana' size='2'>Search again!!</a>
<?
}
?>[/PHP]