Display custom field only if it has a value

            <?php
            $metacatname = get_post_meta( $post->ID, 'related blog articles', true );

            if(!(empty( $metacatname ))):

                $my_query = new WP_Query( array(
                    'category_name'  => $meta_cat_name,
                    'posts_per_page' => 5,
                ) );

                if ( $my_query->have_posts() ):

                    while ( $my_query->have_posts() ) : $my_query->the_post(); ?>   
                        <a href="https://wordpress.stackexchange.com/questions/29266/<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
            <?php
                    endwhile;

                endif;

            endif;

            wp_reset_query();
            ?>

error code: 523