Add a class to a div if custom post type has specific terms?

I was able to figure something out. I created a function and added it to the class name of the div. Probably more work, but it got the job done.

function add_class() {
    if( has_term( 'movies', 'genre' ) ) {
        echo 'on';
    }
}
add_filter('add_class_on', 'add_class');

then add function to div class

<div class="box <?php add_class();?>"</div>

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