change the db and the table name for the query and edit if else statements for computing total