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

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

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

asp.net mvc - breakpoint on javascript in CSHTML? -