db query working, model and view fail