Updated IP and Sql query