Well I changed it, but, I still only get the one result.
I get the same word I used for search and the stotal for that one word.
I Need it to find all keywords that have the search word in it...
So, if i use " tool " for a search word...
It should return many words like tools, subtools, tool box, including stool...
Is this impossible ?
When I do this :
$query="SELECT keyword, stotal from searchword WHERE keyword LIKE '%$keys%' ORDER BY stotal DESC LIMIT 10";
This brings up all the words that have the search word in a string
But like I said I need it to find the search word inside a single word also, like tools, the s at end of tools isn't being included cause of it is like a different word, but still has tool in it..
Anyone got some ideas...
This looks like it should work, but doesn't :
$search = "$keys";
//Remove improper characters.
$searchString = preg_replace("/[^a-zA-Z0-9s]/", "", trim($search));
//Break search phrase into array.
$searchArray = explode(" ", $searchString);
$query="SELECT keyword, stotal from searchword WHERE (keyword LIKE '";
$query.= implode("' OR keyword LIKE '", $searchArray);
$query.="') ORDER BY stotal DESC LIMIT 10";
$result = mysql_query($query) or die("Query failed");
while ($myrow = mysql_fetch_assoc($result)) {
echo $myrow["stotal"];
echo $myrow["keyword"];
}