Search Engine Script

October 8, 2009 at 21:22:50
Specs: Windows XP
I am looking for a simple script search engine which uses database files.
All I really need is an input field with a drop down menu. I need the drop down menu to select a specific database file to search.

The idea is to enter a product description to search, and what type of product catagory to search.

Any help would be greatly apreciated.


See More: Search Engine Script

Report •


#1
October 9, 2009 at 07:28:19
Hi, perhaps some PHP code with something like this might help you achieve your goals.

For the user search form to select/search the database from your site:

<h2>Search</h2>
<form name="search" method="post" action="<?=$PHP_SELF?>">
Seach for: <input type="text" name="find" /> in
<Select NAME="field">
<Option VALUE="db1">db1</option>
<Option VALUE="db2">db2</option>
<Option VALUE="db3">db3</option>
</Select>
<input type="hidden" name="searching" value="yes" />
<input type="submit" name="search" value="Search" />
</form>

Here's the code to perform the actual search against your database.

<?
if ($searching =="yes")
{
echo "<h2>Search Results</h2>";

if ($find == "")
{
echo "

Enter a search term";
exit;
}

mysql_connect("mysql.yourhost.com", "user_name", "password") or die(mysql_error());
mysql_select_db("database_name") or die(mysql_error());

$find = strtoupper($find);
$find = strip_tags($find);
$find = trim ($find);

$data = mysql_query("SELECT * FROM users WHERE upper($field) LIKE'%$find%'");

while($result = mysql_fetch_array( $data ))
{
echo $result['db1'];
echo " ";
echo $result['db2'];
echo " ";
echo $result['db3'];
echo " ";
echo " ";
}

$anymatches=mysql_num_rows($data);
if ($anymatches == 0)
{
echo "No database match";
}
echo "Search Terms" .$find;
}
?>


Report •

#2
October 9, 2009 at 09:18:00
this will be tricky but i think it should work. I will have to self learn myself the basics of PHP but it appears to be very much what i am looking for.

Thanks :)


Report •

#3
October 23, 2009 at 11:07:08
I need a script to start a search engine submission site. Also do you know a script to start a web site traffic site?

[URL=http://www.internet-marketing-website-design.com/]san diego internet marketing company[/URL]


Report •

Related Solutions


Ask Question