getvars function

Get variables from a database