I think it is because the page is sometimes reloading or refreshing - I usually run this via a scheduled task on the server but for testing purposes I'm loading it in the browser. I tried loading it in a different browser and it only created one database record so looks like it's fine. Thanks again.