Send data to sql problem (SOLVED)

If someone could please advise, my script is working fine when pluged in via broadband, its when i connect via 3 or 4g is when i get the problem, and as my device will be living outddors and not even close to a broadband conection i am in trouble :(..

so i am uploading to a database on a live server not localhost, when in testing i used my broadband connection, and all worked well, now i have moved on to the next stage of my project and using a 3g dongle.

Now i am only getting one or two updates within 100 tries, but have full signal on the 3g.

I have overcome this by adding a 2 second delay after the the two empty line, and before colsing the conection.
All is good apart from my script stops running for 2 seconds, and other signals could now be missed.

If anyone could help with a way round this i would be very happy.