If I understand what you want to do, I think you would want to change the "WHERE" line to:
Code:
WHERE ".TABLE_PREFIX."cms_category.category IN ('$category1')
and since you really should use escape_string on a string in case it contains any special characters, change the line that sets $category 1 to
Code:
$category1 = vB::$db->escape_string($entry['title']);
One other thing, it looks like the original code is written to allow field97 to be a comma separated list of category ids, and with the modified code you can only have one title.