php - include all where cases to make one sql query -


here code

if ($st) active_code = '1';  if (!$st) active_code > '0';   select username users active_code = '1'  select username users active_code > '0' 

is there way make 1 sql query ?

any idea please ?

$cond = $st ? "= '1'":" > '0'"; $sql = "select username users active_code $cond"; 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -