Angularjs Loop Through Array Php Functions Sql