I have a Hungarian based language site: <snip/> with articles on different categories.
I want to implement a simple php search engine for my website on pages like this on the top left corner:
<snip/>and on individual pages with photos <snip/> need to be able to make a difference between articles with photos or not image article.
Note: I keep all texts (title, body articles) on a mysql database.
I need some code suggestions, to make this script run fast.
Thanks all - for your time to reply…
you should first make a html form with search fields like this:
<form action="search.php" method="post" name="form">
<input type="text" name="searchterm" />
<input type="submit" name="submit" value="search" />
</form>
then in search.php you should use the mysql functions to check if the term is inside some field in a table
$searched_term=$_POST['searchterm']; // assign the post variable to a new variable
$query = mysql_query("select * from mytable where myfield RLIKE '".mysql_real_escape_string($searched_term)."';"); // creating the sql query to find the term in your table
if (mysql_num_rows($query)>0) { // check if I found the term or not
echo 'found';
}
else {
echo 'not found';
}
you need of course all the code to connect to your db and so on…