I have xml files been imported onto an FTP server. This is stored in location \'/public_html/ctrackxml/\' with a random file name and in the following format:
Use mysql_real_escape_string() on your input. http://se2.php.net/manual/en/function.mysql-real-escape-string.php
It willl not solve your current problem but future ones where escape chars are needed.
Turn on display_errors, enable warnings.
Try debugging with a counter in the foreach loop $i++, or echo every cycle. find out how far it goes before failing..