Complete profile alert issues fixed

Fixed the complete profile alert issue and some queries in the lend and
borrow php files