Okay so Ive written a basic search script where the user can only type in one keyword to search by - and it only searches one column in the DB. This is for an image database containing assorted columns of data. Right now, they can only search for one word in the image's description field - that's not good. I gotta allow them to use multiple words in their search, and let them search almost every column for anything about an image. I just don't know how, have gotten told a number of things with nothing concrete - I want to try to avoid using indexing with multiple pages, since the db will eventually grow to hold about 3,000 records - it's not only to save space, but also to eliminate the number of clicks required by the user; our construction guys arent the most computer / interweb savvy. If youd like to see what I have done already, click on: http://www.darwenstheory.net/intranet_test/search.php - type into the keyword box 'test' and you'll get returned 10 results, 5 per page.
And, here's my search code:
<?php
$User="*";
$Pass="*";
$Host="localhost";
$DB="database";
$Table="images";
$Table2="user";
$Per_Page="5";
$sql_conn=mysql_connect($Host, $User, $Pass) or die("MySQL Error #".mysql_errno().": ".mysql_error());
$sql_db=mysql_select_db($DB);
$SQL="SELECT COUNT(*) AS Total FROM images WHERE s_Description LIKE '%".$_REQUEST['keyword']."%'";
$SQL_Result=mysql_db_query($DB, $SQL);
$SQL_Result_Array=mysql_fetch_array($SQL_Result);
$Total=$SQL_Result_Array['Total'];
$SQL="SELECT * FROM images WHERE s_Description LIKE '%".$_REQUEST['keyword']."%' ORDER BY p_Site";
if (empty($_GET['Result_Set']))
{
$Result_Set=0;
$SQL.=" LIMIT $Result_Set, $Per_Page";
}
else
{
$Result_Set=$_GET['Result_Set'];
$SQL.=" LIMIT $Result_Set, $Per_Page";
}
$SQL_Result=mysql_db_query($DB, $SQL);
$SQL_Rows=mysql_num_rows($SQL_Result) or die(mysql_errno() . mysql_error());
?>
And, here's the code for how the results get returned and formatted (I would very much like to keep this format):
<?php
for ($a=0; $a < $SQL_Rows; $a++)
{
$SQL_Array=mysql_fetch_array ($SQL_Result);
$parksite=$SQL_Array['p_Site'];
$parkproject=$SQL_Array['p_Project'];
$sheettype=$SQL_Array['s_Type'];
$sheetdesc=$SQL_Array['s_Description'];
$sheetiteration=$SQL_Array['s_Iteration'];
$imagepath=$SQL_Array['image_path'];
print "<table code>";
}
?>
I just don't know what to do to get myself a better search 🙁
Thanks in advance for help provided