> > The script cycle is, symbolically: > > foreach (recipients as batch) > { > mail() using batch of recipients; > mysql_query() update table; > sleep(60); > } > final mysql_query() update table as complete; > > why don't you edit your code? foreach (recipients as batch) { mail() using batch of recipients; mysql_query() update table; if(mysql_errno()==ERROR_CODE_YOU_GET){ mysql_connect(); mysql_select_db(); } sleep(60); }