algorithm_model has correct php and mysql syntax, not sure about functionality though