Static page for desktop or mobile

I used this:

<?php if ( wp_is_mobile() && is_front_page() ) {
    wp_redirect( 'http://www.example.com', 301 ); exit;
} ?>

in header.php of theme.

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