Does the 4th time have anything to do with max sockets equaling 4 in the Ethernet library?
Seems like a reasonable starting point for investigation.
client.print("GET /info.php?"); //GET request to write data to the database.
client.print("request=");
//client.print(mod);
client.print(year()); if(month() < 10) { client.print("0"); }
client.print(month()); if(day() < 10) { client.print("0"); }
client.print(day()); if(hour() < 10) { client.print("0"); }
client.print(hour()); if(minute() < 10) { client.print("0"); }
client.print(minute()); if(second() < 10) { client.print("0"); }
client.print(second());
client.println("");
client.println(" HTTP/1.1");
The entire GET request is supposed to be on one line. println() is used ONLY to send the HTTP/1.1 terminator.
If you don't call setSyncProvider(), so the getNtpTime() function never gets called, do you still lock up after 4 calls?