First:
$qry = $mysqli->real_escape_string($qry);
You shouldn't be escaping the ENTIRE query string, this will definitely cause problems.
Second:
$res = $mysqli->query($qry);
$cnt = $res->num_rows;
You need to check if the query was successful before attempting to use the results. Something like:
$res = $mysqli->query($qry);
if( $res === FALSE ) {
trigger_error('DB Error. MySQL said: ('.$mysqli->errno.') '.$mysqli->error,E_USER_ERROR);
} else {
$cnt = $res->num_rows;
Thirdly:
$res->close();
Result object does not have a close method.
Finally: Turn error reporting and display errors to on, I use the following at the top of my scripts while developing (make sure to turn off display errors for production!)
<?php
ini_set('error_reporting', -1);
ini_set('display_errors', True);