I didn’t see any errors in your PHP script. Note that, according to you, sometimes it works sometimes it doesn’t work. If it works sometimes then there is no error in the script or blocks. So I gave the idea to debug your script until it shows what the error shows. When showing the error, you should go to GOOGLE and search. Ohhhhhh GOOGLE, in my day it was just book searches …