Getting categories to change appropriately when using $cat = ‘ ‘;

If you are in a category context this should work and and you’ll get the correct catID to work with.

function getCurrentCatID(){
    global $wp_query;
    if(is_category()){
        $cat_ID = get_query_var('cat');
    }
    return $cat_ID;
}
$catID = getCurrentCatID();

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