php - mysql query if else not work correctly -


in query want add condition

if((select showman preferences `userid`='92') == true )  users.gender !='female' 

here full query

select * `users` users.id != '92' ,          users.id not in (select matched_user_id                                `user_matchs`                                user_id = '92'                               ) ,         users.id not in (select user_id                                `user_matchs`                                matched_user_id = '92'                          , status = 'friend'                               )   , if((select showman preferences `userid`='92') == true )  users.gender !='female' 

my logic isifuser 92 showman value true add condition users.gender !='female' if showman value false add condition users.gender !='male'

does changing last part work :

and ((not (select showman preferences `userid`='92')) or (users.gender !='female')) 

or full query

select 'users'.* `users` join preferences on `userid` = users.id users.id != '92' ,   users.id not in (select matched_user_id                    `user_matchs`                    user_id = users.id                   ) ,   users.id not in (select user_id                    `user_matchs`                    matched_user_id = users.id                    , status = 'friend'                   )  , ((not `preferences`.`showman`) or (users.gender !='female')) 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -