using query_posts to pull posts out of a category in a while loop. Getting odd echo

change the_ID() to get_the_ID(). calling the_ID() prints the post’s ID, while get_the_ID() simply returns it and allows you to use it further on.

reference : get_the_ID()

tech