I have this code:
$post = 0;
$rows = $wpdb->get_results( "select * from table where if('".$post."' != 0, id = '".$post."', id != 0) " );
If $post doesn't have value 0, I need to take all rows which have id $post, and if $post has id 0, I need to take all rows which don't have id 0, but it doesn't return any result