replace mysql with queryDB(), but needs more work