php - Search query not working -


i have coded mysql query multiple fields, , result should match fields. below code,

select e.es_id, e.es_sex, e.service_type, e.working_name,  d.es_age, d.es_city, d.es_regional_city escorts e  inner join escorts_details d on e.es_id = d.es_id   es_sex '%" . $es_sex . "%'  , category '%" . $category  ."%'  , es_city '%" . $es_city  ."%'  , es_regional_city '%" . $es_regional_city  ."%'"; 

and when m executing code after filling fields..

select e.es_id, e.es_sex, e.service_type, e.working_name, d.es_age, d.es_city, d.es_regional_city escorts e  inner join escorts_details d  on e.es_id = d.es_id  es_sex '%male%'  , category '%waitresses%'  , es_city '%7%'  , es_regional_city '%%' 

its still showing female details, if see excuted query, have filled "male" (es_sex '%male%').

i don't know m doing wrong.

please me.

thanks.

it's because % represents string of characters. in case %male% mean 'female', 'fe' being put in place of first %. remove % , es_sex = 'male', this:

select e.es_id, e.es_sex, e.service_type, e.working_name, d.es_age, d.es_city, d.es_regional_city escorts e  inner join escorts_details d  on e.es_id = d.es_id  es_sex ='male'  , category '%waitresses%'  , es_city '%7%'  , es_regional_city '%%' 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -