Hi,
I thought that you liked to get all High Schools containing "Stanford" in their names...
But now I presume that You *also* want to get all those high schools
with their names somehow a substring of UserInput ...
Here is my trial using INSTR(str,substr) function..
This will get user input($x) and gets school names which are substring of $x and also those school names of which $x is a substring
Assuming Table name to be 'school' and field name to be 'HSchool'
mysql>SELECT * FROM school
WHERE INSTR(HSchool,$x)>0 OR INSTR($x,HSchool)>0;
For your user input "Carl Sandburg High School" it should be like...
mysql>SELECT * FROM school
WHERE INSTR(Hschool,'Carl Sandburg High School')>0
OR
INSTR('Carl Sandburg High School',HSchool)>0 ;
Hope this helps ...
Regards,
Ram.
P.S : For this to work the searched keyword should atleast be in order
'Carl High School Sandburg' won't list 'Carl Sandburg Hish School'
but it will list 'Carl' if there is some entry like that...
For String Functions
Refer:
http://dev.mysql.com/doc/mysql/en/String_functions.html
We Learn the Most When we have to Invent