search from the first letter of first name or last name in PHP and MYSQL -


i need search first name or last name beginning of characters. example, firstname michael , lastname jordan. if search "dan" or "hae" words, shouldn't return result. if search "mic" or "jor", should return firstname , lastname together. there way mysql ?

my following code not return expect.

select * users (firstname '%$searchword%' or lastname '%$searchword%') 

if want search beginning of word have place wildcards @ end of condition:

select * `users` (`firstname` '$searchword%' or `lastname` '$searchword%') 

Comments

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -