Custom Post excerpt not working correctly

Why not use substr?

Function example that returns shortened excerpt:

function shortened_excerpt() {

    echo substr(get_the_excerpt(), 0, 30) . "...";

}

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