Mysql query not working on WordPress 4.2.2

Try “bootstrapping” WordPress for your custom script first: include '../../../wp-load.php' (you might need to adjust the path for your needs).

Then you can safely use the $wpdb class, such as $wpdb->get_results and other goodies. Don’t forget to escape/clean your incoming data, if any.
WordPress documentation on $wpdb

PS: always try to use “builtin” functions. The codex above is gold.

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