3 search fields Need to return results for multiple words for each feild NOT all feilds
Jonathan Fortis Mar 16, 2012 2:17 AMI have three search boxes here
<form id="Jobtitle" name="Jobtitle" method="get" action="../current-positions.php">
<p>
<input name="tk_job_title" type="text" class="textfeilds" value="Job Title" size="32" />
<label for="Location"></label>
<input name="tk_job_location" type="text" value="Location" size="32" />
<label for="Salary"></label>
<input name="tk_job_salary" type="text" class="textfeilds" value="Salary" size="32" />
</p>
<p align="right">
<input type="image" src="../images/jobsearch-button.png" width="120" height="17" border="0" value="Submit" alt="submit" usemap="#Map" />
<map name="Map" id="Map">
<area shape="rect" coords="1,0,67,16" href="#" />
</map>
</p>
</form>
I have built the results page below
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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;
}
}
$maxRows_Recordset1 = 5;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$var_tk_job_title_Recordset1 = "%";
if (isset($_GET["tk_job_title"])) {
$var_tk_job_title_Recordset1 = $_GET["tk_job_title"];
}
$var_tk_job_location_Recordset1 = "%";
if (isset($_GET["tk_job_location"])) {
$var_tk_job_location_Recordset1 = $_GET["tk_job_location"];
}
$var_tk_job_salary_Recordset1 = "%";
if (isset($_GET["tk_job_salary"])) {
$var_tk_job_salary_Recordset1 = $_GET["tk_job_salary"];
}
$var_tk_job_salary_Recordset1 = "%";
if (isset($_GET["tk_job_salary"])) {
$var_tk_job_salary_Recordset1 = $_GET["tk_job_desc"];
}
mysql_select_db($database_hostprop, $hostprop);
$query_Recordset1 = sprintf("SELECT tk_job_title, tk_job_location, tk_job_salary, LEFT(tk_job_desc,200) as truncated_job_desc FROM think_jobsearch WHERE tk_job_title LIKE %s OR tk_job_location LIKE %s OR tk_job_salary LIKE %s OR tk_job_desc LIKE %s", GetSQLValueString($var_tk_job_title_Recordset1, "text"),GetSQLValueString($var_tk_job_location_Recordset1, "text"),GetSQLValueString($var_tk_job_salary_Recordset1, "text"),GetSQLValueString($var_tk_job_desc_Recordset1, "text"));
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $hostprop) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
and the results here
<table width="655" border="0" cellspacing="5" cellpadding="0">
<tr>
<td colspan="2" class="Titlegreen"><?php echo $row_Recordset1['tk_job_title']; ?></td>
</tr>
<tr>
<td colspan="2" class="textblack"><?php echo $row_Recordset1['truncated_job_desc']; ?>....read more</td>
</tr>
<tr>
<td width="250"> </td>
<td width="405"><div align="right"><span class="pos_salary"><?php echo $row_Recordset1['tk_job_salary']; ?></span><span class="pos_location">/<?php echo $row_Recordset1['tk_job_location']; ?></span></div></td>
</tr>
</table>
at the moment if i search in the tk_job_title for security it will only display the results for security even if i have security guard in the DB.
or if i search Sydney it will only return these results even if i have Sydney Australia in the DB
can someone help?
thanks in advance