Creating custom function in wordpress to return data from database

In your header.php

$images = getSliderImages();
    foreach ( $images as $img ) {
        echo '<img src="' .$img. '" />';
    }

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