473,395 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Search Engine not returning any results.

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&nbsp;to&nbsp;view&nbsp;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]
Oct 1 '07 #1
3 1368
Motoma
3,237 Expert 2GB
You are going to have to do some testing in order to narrow down where the error occurs. Step in and place echo and print_r statements in your code and check that you are dealing with the values you expected to be.
Oct 1 '07 #2
You are going to have to do some testing in order to narrow down where the error occurs. Step in and place echo and print_r statements in your code and check that you are dealing with the values you expected to be.
I've done a little testing and it looks like it's not returning any results, regardless of the search. I typed in something like sofa, and nothing returns. Also, try typing in something like "brown leather". It takes off the 'er' on leather. I'm going to find another version of this search engine to start from. I'm pretty disappointed in it so far.
Oct 1 '07 #3
Motoma
3,237 Expert 2GB
So, is it failing at the SQL Query? How would you know?

The easiest way would be to echo the query before it is executed, paste it into an SQL prompt, and see if you get the right results.
Oct 1 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: R. Rajesh Jeba Anbiah | last post by:
Q: Is PHP search engine friendly? Q: Will search engine spiders crawl my PHP pages? A: Spiders should crawl anything provided they're accessible. Since, nowadays most of the websites are been...
1
by: SROSeaner | last post by:
I am trying to meta-search the search engines. At the very least, I am trying to capture the results returned from any search engine (doesn't matter which one), and pick out the results I find...
5
by: George | last post by:
Hi, Anyone has the background for explaining? I have made a search on my name and I have got a link to another search engine. The link's title was the search phrase for the other search engine...
8
by: Craig Cockburn | last post by:
Hi I'm aware of the use of robots.txt and the use of <META NAME="ROBOTS" CONTENT="index,follow"> However, what would be more useful is to be able to control within a page which elements of...
14
by: vic | last post by:
My manager wants me to develop a search program, that would work like they have it at edorado.com. She made up her requirements after having compared how search works at different websites, like...
39
by: Noticedtrends | last post by:
Can inference search-engines narrow-down the number of often irrelevant results, by using specific keywords; for the purpose of discerning emerging social & business trends? For example, if...
1
by: Jack-of-all-traits | last post by:
This is a big problem and I really need help, no one seems to know how to solve this problem. I want to take the data from a record in a particular a field that contains the names of generic...
4
by: zakhirn | last post by:
Hello, I have an extremely new user to XML and XSL, and I would like to know how to search XML data via a input form in HTML, and have the results displayed in HTML. If anyone has code that...
2
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Is there a way to start, pause and resume a recurrsive search exactly where you left off, say in the registry programmatically? -- Michael Bragg,...
0
by: passion | last post by:
"Specialized Search Engines" along with Google Search Capability (2 in 1): http://specialized-search-engines.blogspot.com/ Billions of websites are available on the web and plenty of extremely...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.