I have changed the code to the following and decremented array count by 1 on $c = count($headerTable)-1; and it seems to work Thanks a lot guys for helping
$query = "INSERT INTO ".$table."(FileIdentifier, Version, ReceiverIdentifier, Date, Time, FileGenerationNumber) VALUES";
$c = count($headerTable)-1;
echo "headerTable Count = ".$c;
$numberOfLoops=0;
for($i = 0; $i < $c; $i += 6)
{
// Add the next batch of values to the query string
if($i==0)
{
$query.= "('".$headerTable\[$i\]."','".$headerTable\[$i+1\]."','".$headerTable\[$i+2\]."','".$headerTable\[$i+3\]."','".$headerTable\[$i+4\]."','".$headerTable\[$i+5\]."')";
}
else
{
$query.= ", ('".$headerTable\[$i\]."','".$headerTable\[$i+1\]."','".$headerTable\[$i+2\]."','".$headerTable\[$i+3\]."','".$headerTable\[$i+4\]."','".$headerTable\[$i+5\]."')";
}
echo $query;
echo 'The number of loops';
echo $numberOfLoops++;
$result = mysql\_query($query) or die('Query failed: ' . mysql\_error());
}
return true;
echo 'The number of loops';
echo $numberOfLoops++;
}