getting number of transactions from database