What's the best method to go about making a search engine for my mysql table?
Search Engine
Create a form
<form method="post" action="process.php">
Name: <input type="text" name="name"><br><br>
<input type="submit" value="submit">
Then on process.php
if (!$_POST['name']) {
header("Location: form.php");
} else {
$query = mysql_query("SELECT * FROM your_table WHERE name LIKE '%name%'") or die(mysql_error());
// display results
}
Cgraz
I need something that won't kill my server with 10 users online.
There are 100,000 rows and i tried that in the past server load jumped from 0.02 to 19 in 30 seconds with 10 searches.
Hmm, I'm not to sure about that then. I'll let someone more knowledgable than me in this area jump in.
Cgraz
Thanks for trying though. I'm using match against right now which with 40 instantanteous searches raises server load by .4 but then there's a problem i ran into which is here
http://www.phpbuilder.com/board/showthread.php?s=&threadid=10225291
Is your database properly indexed. A table of 100,000 rows is nothing for MySql. You sql statement are not normalized or you need to index the tables correctly.
An example is I have a Dbase of 125,000 articles running on an DUAL P3 650MHZ server which searches in .25 seconds that is 1/4 of a second.
You are doing something wrong.
Oh I didn't index my tables. The server is 1.2GhZ, 1GB ram server load usually 0.03 on average with 5 of my sites hosted each php/mysql backend with an average of 200 users online at a time.
only thing is when they do the search if they search for something like "keyword1 keyword2 kerword3 keryword4" and mysql has to go where title like '%$keyword[1]%' and title like '%$keyword[2]%' .... etc.. wouldn't that create a big server load even if indexed?
If you look into the Tips and Hints sections of the Articles for this website, you'll find a pretty good article on how to write a search engine.