improve MySQL part (errors, test), use PHP constants for new line