category__not_in and id values from variable

get_category_by_slug() returns a category object or FALSE:

$cat1 = get_category_by_slug( 'cata' );
print '<pre>' . htmlspecialchars( print_r( $cat1, TRUE ) ) . '</pre>';

Result:

stdClass Object
(
    [term_id] => 3
    [name] => Cat A
    [slug] => cata
    [term_group] => 0
    [term_taxonomy_id] => 3
    [taxonomy] => category
    category__not_in and id values from variable => 
    [parent] => 0
    [count] => 2
    [cat_ID] => 3
    [category_count] => 2
    [category_description] => 
    [cat_name] => Cat A
    [category_nicename] => cata
    [category_parent] => 0
)

So, to get an array of IDs just check if you get an object for each slug and add the term_id to the array:

$category__not_in = array();
$slugs            = array ( 'cata', 'catdoesnotexist' );
foreach ( $slugs as $slug )
{
    $cat = get_category_by_slug( $slug );
    $cat and $category__not_in[] = $cat->term_id;
}
$args = array (
    'category__not_in' => $category__not_in
);

Instead of hard coding the slugs in your script consider to add term meta data to the categories. You will need an additional query to find all needed terms, but your script stays reusable.

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