|
 |
Search our database for parts and components, if you can not find the part you are looking for please send us a Request for Qoute.
//This is only displayed if they have submitted the form
if ($searching =="yes")
{
echo "Search Results";
//If they did not enter a search term we give them an error
if ($find == "")
{
echo " You forgot to enter a search term";
echo " ";
exit;
}
// Otherwise we connect to our Database
mysql_connect("localhost", "dimo_sergio", "Tr00p563") or die(mysql_error());
mysql_select_db("dimo_db") or die(mysql_error());
// We preform a bit of filtering
$find = strtoupper($find);
$find = strip_tags($find);
$find = trim ($find);
//Now we search for our search term, in the field the user specified
$data = mysql_query("SELECT part, part_number_2, alt_part, alt_part_number_2, nsn, nsn2, description FROM parts WHERE part LIKE'%$find%' OR part_number_2 LIKE '%$find%' OR alt_part LIKE '%$find%' OR alt_part_number_2 LIKE '%$find%' OR nsn LIKE '%$find%' OR nsn2 LIKE '%$find%'OR alt_part_number_2 LIKE '%$find%'");
$countofrecs=mysql_query("SELECT count(*) from parts WHERE part LIKE '%".$find."%' OR part_number_2 LIKE '%".$find."%' OR alt_part LIKE '%".$find."%' OR alt_part_number_2 LIKE '%".$find."%' OR nsn LIKE '%".$find."%' OR nsn2 LIKE '%".$find."%'");
$cnt=mysql_fetch_array($countofrecs) ;
$result = mysql_query("SELECT * FROM parts");
$num_rows = mysql_num_rows($result);
echo "Total records = {$cnt[0]}";
echo " of {$num_rows} parts.";
echo " ";
echo " ";
//And we display the results
while($result = mysql_fetch_array( $data ))
{
echo "Part Number: ";
echo $result['part'];
echo " ";
echo "Alt. Part Number: ";
echo $result['alt_part'];
echo " ";
echo "NSN: ";
echo $result['nsn'];
echo " ";
echo "Description: ";
echo $result['description'];
echo " ";
echo " ";
echo "To get a RFQ for this item please this RFQ Form";
echo " ";
echo "------------------------------------------------------------------------------------";
echo " ";
echo " ";
}
//This counts the number or results - and if there wasn't any it gives them a little message explaining that
$anymatches=mysql_num_rows($data);
if ($anymatches == 0)
{
echo "Sorry, but we can not find an entry to match your search.
";
}
//And we remind them what they searched for
echo "Searched For: " .$find;
echo " ";
echo "Date of query: ";
echo date("l, F d, Y h:i a" ,time());
echo " ";
echo "Your ip address: ";
echo $_SERVER['REMOTE_ADDR'];
}
?>
All parts from DIMO Corp. come with our company C of C.
|