Changing regular db connection to $wpdb

Use the global $wpdb object to query your tables. The get_results() method will return your results as you need:

global $wpdb;

$query = 'SELECT * FROM students';
$query_results = $wpdb->get_results($query);
foreach ($query_results as $student) {
    // ...
}

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