Adding $session_resource_timeout which will be set to config setting. Also renaming $result into $rows. Removing useless if statement.