i'm not an OOP expert, but i can see a missing DESC in your sql query (if you need the last ID):
$query = "SELECT id FROM reviews2_category WHERE category NOT LIKE 'book_%'
AND category NOT LIKE 'magazine_%'
ORDER BY id DESC LIMIT 1";
And lets see this condition:
if ( empty($this->num_Error()) )
but, lets test the logic:
if(empty)
{
$query='xxxxxxxxx';
}
run this $query // but if error_num is not empty your $query has not set.