Just tried to clean the code a bit more.

Removed the exit(header()) when inserting and deleting a comment. If you
insert or delete the comment before making the SELECT query there is no
need to refresh the page.