hey there all.... ive been banging my head against the wall for about two hours on this one.... basically what im trying to do is grab certain records from my main table, then im inserting them into a temporary table which is exactly the same as the main table..... then im doing a full text search on this temp table, based on user input, sorting the results
now the original filter is working fine (the first part where i grab any records from the main table that match the $abuse_variable)... the insert into the temp table works fine as well, and i can see the entry(s) into the temp table if i dont bother trying to do a full text search on it
the problem lies with the full text search.... it never finds anything, even if i make sure that what im looking for exists in the temp table... it comes back with my "nothing found" error message... now the full text search works just fine if i use it on the main table, but as soon as i try and run it on the temp table, it comes back with nothing found
i hope that wasnt too confusing, here is my code, and i hope somebody can help me out on this one
<?
include("other.inc");
$connection = mysql_connect($host,$user,$password)or die ("couldn’t connect to server");
$db = mysql_select_db($database,$connection)or die ("Couldn’t select database");
$userinput = "{$_POST['criteria']}";
if ($userinput == "")
{
include("ssm_banner.php");
include("ssm_nav.php");
echo "<style type='text/css'>
<!--
.style3 {font-size: 12px}
-->
</style>";
echo "<table width ='75%' border='0' cellpadding='10'><tr><td width='5%'></td><td width='90%'>";
echo "<style type='text/css'>
.style1 {color: #FF0000}
</style>";
echo "<b><span class='style1'>You did not enter anything to search for, please try again.<br>Click <a href='faq.php?page=directory'>here</a> for help with searches.</span></b>";
echo "<form name='search' action='abuse_search_redirect.php?page=directory' method='post'>";
echo "Enter your search criteria:<br>";
echo "<input type='text' name='criteria'><br>";
echo "<input type='submit' name='search' value='Search'>";
echo "</form>";
echo '<p><a href="adv_search.php?page=directory">Advanced Search</a></p>';
echo "<p align='center'> </p><br>";
echo "<a href='admin.php?page=directory'>Admin Control</a>
<a href='faq.php?page=directory'>FAQ/Help</a> <a href='contact_us.php?page=directory'>Contact Us</a>";
echo "<p>";
echo "</td><td width='5%'></td></tr></table>";
exit;
}
else
{
$delete_query = "delete from houses_temp";
$result_delete = mysql_query($delete_query) or die (mysql_error($connection));
$abuse_variable = "Abuse Manual";
$query_abuse_filter = "SELECT * from houses where grouping like '%$abuse_variable%'";
$query_abuse_filter .= " and altGrouping like '%$abuse_variable%'";
//below is the table layout for results
$result_abuse_filter = mysql_query($query_abuse_filter) or die (mysql_error($connection));
while ($row = mysql_fetch_array($result_abuse_filter,MYSQL_ASSOC))
{
extract($row);
$name2 = addslashes($name);
$address2 = addslashes($address);
$postalCode2 = addslashes($postalCode);
$phoneNum2 = addslashes($phoneNum);
$altPhoneNum2 = addslashes($altPhoneNum);
$description2 = addslashes($description);
$add_record = "insert into houses_temp (name, address, city, province, postalCode, phoneNum,
altPhoneNum, description, grouping, latitude, longitude, altGrouping, website) values ('$name2',
'$address2', '$city', '$province', '$postalCode2', '$phoneNum2', '$altPhoneNum2', '$description2',
'$grouping', '$latitude', '$longitude', '$altGrouping', '$website')";
$result_add = mysql_query($add_record) or die (mysql_error($connection));
}
//search for the matching records from the abuse manual that match the user input
$query = "SELECT *, MATCH(name, city, description, website, grouping, altGrouping) AGAINST('$userinput') AS score FROM houses_temp
WHERE MATCH(name, city, description, website, grouping, altGrouping) AGAINST('$userinput') ORDER BY score DESC";
$delete_query = "delete from houses_temp";
$result_delete = mysql_query($delete_query) or die (mysql_error($connection));
//below is the table layout for results
$result = mysql_query($query) or die (mysql_error($connection));
while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
extract($row);
$name2 = addslashes($name);
$address2 = addslashes($address);
$postalCode2 = addslashes($postalCode);
$phoneNum2 = addslashes($phoneNum);
$altPhoneNum2 = addslashes($altPhoneNum);
$description2 = addslashes($description);
$add_record = "insert into houses_temp (name, address, city, province, postalCode, phoneNum,
altPhoneNum, description, grouping, latitude, longitude, altGrouping, website) values ('$name2',
'$address2', '$city', '$province', '$postalCode2', '$phoneNum2', '$altPhoneNum2', '$description2',
'$grouping', '$latitude', '$longitude', '$altGrouping', '$website')";
$result_add = mysql_query($add_record) or die (mysql_error($connection));
}
header("Location: abuse_show_search.php?page=directory");
}
?>