Use have_posts() with array of post results retrieved by $wpdb->get_results

setup_postdata will let you use loop functions with post results via get_posts.

another option is to use the various filters available to alter WP_Query‘s behavior- posts_join, posts_where, posts_orderby.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)