Forum Moderators: open
So far I have it so that it will return by first letter;
$letter=$_GET['search'];
SELECT Name FROM films WHERE Name LIKE '$letter%'
I figured that if I did the same without the % it would select any part of the Name and return them.
SELECT Name FROM films WHERE Name LIKE '$letter'
I tried it and it didn't work.
Anyone have any ideas?
Thanks
J
Of course, if someone enters "a" you will get every single movie that has an "a" anywhere in the title. So you may want to require a minimum number of letters to be in the input string.
Oh, and of course you'll also want to use the standard procedures to prevent SQL injection attacks.
[edited by: LifeinAsia at 4:49 pm (utc) on Feb. 13, 2009]