I have this little problem. I take data from MySQL using search field.
I have this code to compare if any field "number" has the same value and try to echo it on the screen.
Code: Select all
$query = mysql_query("SELECT id, date, kood, kogus, nimetus, number, kes, komm, staatus, ladu FROM tellimus WHERE kood like '%$otsi%' or nimetus like '%$otsi%' or number like '%$otsi%' or komm like '%$otsi%' order by id");
//display row
while ($row = mysql_fetch_array($query)) {
$numberotsi=$row['number'];
}
$_SESSION['vali'] = "WHERE kood like '%$otsi%' or nimetus like '%$otsi%' or komm like '%$otsi%' or number like '%$otsi%' or number like '%$numberotsi%' order by id" or die ('Error: ' . mysql_error());
When i have a code lets say:
1234 and the orderers name is John Smith 987654
2345 and the orderers name is Smith John 987654
Now i search the product code 1234 i get the result: (search engine uses the string and looks fields: kood, nimetus,number)
1234 and the name is John Smith.
Well i know that he has some more products. Now when i serch the Smith (again search engine uses the string and looks fields: kood, nimetus,number) i get the result:
1234 and the orderers name is John Smith 987654
2345 and the orderers name is Smith John 987654
bacuse string Smith is in number filed and the other line has the Smith string in it it displays both lines.
But when i search: John Smith 987654
it wont show me the line: Smith John 987654
How can i do that: John Smith 987654 = Smith John 987654
That's the main question.