Database code but it keeps crashing.