Ok, so after looking at my coding again, I realised that line 12 of dynamic2.php had an error where, I had placed a space between quotations as follows:
} while ($CheckEmpty!=" ");
This should have been:
} while ($CheckEmpty!="");
Which has solved the issue of the length of processing time and resources as well as not returning "Not applicable" when entering a 0 or nothing at all!!
Regds
Jamal