PHP MYSQL search for postcode using LIKE -


i have query searches postcode using like. postcode fine if puts full postcode e.g. sw14 4np. if put in sw1 return sw1+ results. how can make if put sw1, display sw1 postcode , not sw11, sw14 etc.

my query is:

select postcode data postcode '$search%' 

the database postcodes stored sw14 4np etc space.

use regular expression based pattern matching:

where postcode rlike '^$search( ?[0-9][a-z]{2})?' 

Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -