Hi there,
I have a problem regarding searching for keywords from a field in a table in MySQL.
In a.php page:
<form method="post" action="b.php">
<input name="Keywords">
</form>
In b.php page:
$Query = " SELECT * FROM TableName WHERE FieldName like '%$_POST[Keywords]%' ";
This will works only if the user wrote 1 word and that word is exactly in that field, BUT what I want is:
to add another inputs to the form:
<input type="radio" name="SearchMethod" value="AllWords">
<input type="radio" name="SearchMethod" value="AnyWord">
So if the user choused "AllWords", the query should returns the records that only have all words and not nesesary same order and not same letter case. (i.e. the user searched for "Toyota Supra" and in DB is "supra toyota"
And if he choused "AnyWord", how can I test each word in the "Keywords" input?
I hope I was clear
I have a problem regarding searching for keywords from a field in a table in MySQL.
In a.php page:
<form method="post" action="b.php">
<input name="Keywords">
</form>
In b.php page:
$Query = " SELECT * FROM TableName WHERE FieldName like '%$_POST[Keywords]%' ";
This will works only if the user wrote 1 word and that word is exactly in that field, BUT what I want is:
to add another inputs to the form:
<input type="radio" name="SearchMethod" value="AllWords">
<input type="radio" name="SearchMethod" value="AnyWord">
So if the user choused "AllWords", the query should returns the records that only have all words and not nesesary same order and not same letter case. (i.e. the user searched for "Toyota Supra" and in DB is "supra toyota"
And if he choused "AnyWord", how can I test each word in the "Keywords" input?
I hope I was clear