Searching your entire database is possible, but doesn't really sound necessary -- there would be no point in searching number fields of the search string has numbers and letters, etc.
20,000 records doesn't sound like a lot but it's usually the total amount of data (in bytes) that makes a complete search difficult.
For the one table example you gave, this might work:
<?php
if (isset($_POST["submit"])) {
if (!isset($_POST["q"])) {
die("Your query was not set!");
}
if (strlen($_POST["q"]) < 1) {
die("You didn't enter anything!");
}
$db = mysqli_connect("your_database_host", "your_database_user", "your_database_password", "mysql_store");
if (mysqli_connect_error()) {
die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error() . "\n");
}
$escaped_query_string = mysqli_real_escape_string($db, $_POST["q"]);
$sql = "SELECT * FROM Parts
WHERE PartNumber LIKE '%$escaped_query_string%'
OR Description LIKE '%$escaped_query_string%'
OR Qty LIKE '%$escaped_query_string%'";
$result = mysqli_query($db, $sql)
or die("Query failed: " . $sql . "\n");
if (mysql_num_rows($result) < 1) {
die("no results found");
} else {
while ($row = mysqli_fetch_array($result)) {
echo nl2br(print_r($row, TRUE));
}
}
} else {
show_form();
exit;
}
// this function shows your HTML form
function show_form() {
?>
<html>
<body>
<form>
<input type="text" name="q">
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
<?
} // show_form()
?>
There are a variety of problems that has:
If you search for % in your search, you'll get weird behavior
If you search for _ in your search, you'll get weird behavior
Doesn't really use indexes of any kind to search, but will probably be fairly speedy on a small db.
I dunno, other stuff.