Postgres Loop Through Array Php Example