Below i have included a search form and the query going along with it.
I didn't included the show results of this script because i don't think it's nessercary.
The problem i have is that i cannot search in all the fields for the keyword. How can i make a selection in the search form where i can search in all the fields at once. i tried some things but these didn't worked. I cannot imagine it is something difficult, but heck i'm a newbie 🙁
Anywayz the search form here
<h5>Quick Search </h5>
<form action="\knowledgebase\search\results.php" method="post" name="search">
<strong>Sellect Search Category:</strong><br />
<select name="type" class="form">
<option value="id">id</option>
<option value="Date_Origin">Date_Origin</option>
<option value="Information_Date">Information_Date</option>
<option value="category">Category</option>
<option value="Machine_Type_nr">Instrument_Type_nr</option>
<option value="description">Description</option>
<option value="DY_nr">DY_nr</option>
<option value="Software">Software</option>
<option value="Software_version">Software_version</option>
<option value="Firmware">Firmware</option>
<option value="Firmware_version">Firmware_version</option>
<option value="Originatior">Originator</option>
<option value="Keywords">Keywords</option>
<option value="Long_Description">Long_Description</option>
<option value="Answer_keywords">Answer_keywords</option>
<option value="Full_answer">Full_answer</option>
</select>
<br /><br />
<strong>Search Keyword:</strong><br />
<input name="keyword" type="text" size="25" class="form" />
<br /><br />
<input type="reset" name="reset" value="Reset" title="click here to reset form" />
<input type="submit" name="action" value="submit" title="click here to submit form" />
</form>
And the search query
$host = "localhost";
$user = "root";
$password = "";
$dbname = "knowledgebase";
$tablename = "information";
$link = mysql_connect($host, $user, $password);
$query = "SELECT * FROM $tablename WHERE ".$type." LIKE '%".$keyword."%'";
$result = mysql_db_query ($dbname, $query, $link);
$num=mysql_numrows($result);
$keyword = stripslashes($keyword);
print("Your search for <strong>\"$keyword\"</strong> in the <strong>\"$type\"</strong> category returned: <strong>".$num_results."</strong> results<br /><br />\n");
mysql_close($link);
If any1 could help me i would be a very happy newbie 🙂
thx in advance
with kind regards