Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Search and Print

July 7, 2000

Set that query to $search, and print out the results like so:


<?php

$getresults = mysql_query($search);
$resultsnumber = mysql_numrows($getresults);

IF ($resultsnumber == 0) {

    PRINT 
"Your search returned no results. Try other keyword(s).";

} ELSEIF ($resultsnumber > 0) {

    PRINT 
"Your search returned $resultsnumber results<BR>Listing
        them in order of relevance&lt;BR>&lt;BR>";
    for($count = 0; $count < $resultsnumber; $count++) {
        $body = mysql_result($getresults,$count,"blob");
        $qid = mysql_result($getresults,$count,"qid");
        
//tighten up the results

        $body2print = substr($body, 0, 100);
        $cnote = $count+1;
        PRINT "$cnote. <a href=yourcontent.php3?qid=$qid>
\        <i>$body2print...</i></a><BR>";
    }
}

?>

Presto, you've got keyword searching for your database, complete with relevancy ranking. It may not be Google or altavista. It may not support all those fancy boolean operators, or excite's (*cough*) conceptual mapping technology. But it works, its quick and enough to handle your user's demand.

Here's that list of noisewords:


noisewords.txt
--------------
a
about
after
ago
all
almost
along
also
am
an
and
answer
any
anybody
anywhere
are
aren't
around
as
ask
at
bad
be
been
before
being
best
better
between
big
but
by
can
can't
come
could
couldn't
day
did
didn't
do
does
don't
down
each
either
else
even
ever
every
everybody
everyone
far
find
for
found
from
get
go
going
gone
good
got
had
has
have
haven't
having
her
here
hers
him
his
home
how
href
I
if
in
into
is
isn't
it
its
know
large
less
like
little
looking
look
many
me
more
most
must
my
near
never
new
news
no
none
not
nothing
of
off
often
old
on
once
only
or
other
our
ours
out
over
page
please
question
rather
recent
she
should
sites
small
so
some
something
sometime
somewhere
than
true
thank
that
the
their
theirs
them
then
there
these
they
this
those
though
through
thus
time
times
to
too
under
until
untrue
up
upon
use
users
version
very
via
want
was
way
web
were
what
when
where
which
who
whom
whose
why
wide
will
with
within
without
world
worse
worst
would
www
yes
yet
you
your
yours
How

--clay

Make All of Your Data Compatible
Slapping together a search engine for your database is easy with PHP and MySQL


Up to => Home / Authoring / Languages / PHP / SearchEngine




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers