Here is the URL where the code is posted:
http://www.roomfulexpress.com/newsit.../response2.php
I pulled this code from:
<Link removed>
The code as a whole seems to make sense to me, but I can't figure out where I went wrong. Any help is appreciated!
Here is the actual code that I'm using [PHP]<form action="response2.php" method="post" name="form">
<input name="search" type="text" />
<input type="submit" name="Submit" value="Search" />
</form>
<?php
require_once('db.php');
include('classes/stem.php');
include('classes/cleaner.php');
if( !empty ( $_POST['search'] ) ):
$string = $_POST['search'];
$stemmer = new Stemmer;
$stemmed_string = $stemmer->stem ( $string );
$clean_string = new jSearchString();
$stemmed_string = $clean_string->parseString ( $stemmed_string );
$new_string = '';
foreach ( array_unique ( split ( " ",$stemmed_string ) ) as $array => $value )
{
if(strlen($value) >= 3)
{
$new_string .= ''.$value.' ';
}
}
$new_string = substr ( $new_string,0, ( strLen ( $new_string ) -1 ) );
if ( strlen ( $new_string ) > 3 ):
$split_stemmed = split ( " ",$new_string );
mysql_select_db($database);
$sql = "SELECT DISTINCT COUNT(*) as FAMILY_NAME, FAMILY_CD FROM tblFamily WHERE (";
while ( list ( $key,$val ) = each ( $split_stemmed ) )
{
if( $val!='' && strlen ( $val ) > 0 )
{
$sql .= "((FAMILY_NAME LIKE '%".$val."%' OR FAMILY_CD LIKE '%".$val."%' OR FAMILY_DESC LIKE '%".$val."%')) OR";
}
}
$sql=substr ( $sql,0, ( strLen ( $sql )-3 ) );//this will eat the last OR
$sql .= ") GROUP BY FAMILY_CD ORDER BY FAMILY_NAME DESC LIMIT 10";
$query = mysql_query($sql) or die ( mysql_error () );
$row_sql = mysql_fetch_assoc ( $query );
$total = mysql_num_rows ( $query );
if($total>0):
while ( $row = mysql_fetch_assoc ( $query ) )
{
echo("<table height=175px>");
echo("<tr>");
echo("<TD width=150px>");
?>
<SCRIPT LANGUAGE="JavaScript">
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=1,statusbar=0,men ubar=0,resizable=1,width=720,height=800,left = 500,top = 125');");
}
</script>
<A HREF="javascript:popUp('familyprofile.php?FAMILY_C D=
<?php echo("" . $row["FAMILY_CD"] . "");?> ')">
<?php echo("<img src= " . $row["TN"] . " click to view profile /></a></TD>");
echo("</tr>");
echo("<tr>");
echo("<TD width=150px><h1> " . $row["FAMILY_NAME"] . "</h1></TD>");
echo("</tr>");
echo("<tr>");
echo("<TD width=150px> " . $row["PACKAGE_PRICE"] . "</TD>");
echo("</tr>");
}
echo("</table>");
echo("</table>");
echo("<br/>");
endif;
endif;
endif;
?> [/PHP]