The code below selects some data from an Access 2000 dbase, loops through and inserts the records into a temporary table. The correct number of records gets displayed but when it comes to inserting the records, the last record never gets added.

Does anyone know why this is happening. Is my code right. Has anyone else tried a simular thing and got the correct results.

I'm desperate so any help would be greatly appreciated.

PHP Code:
// List records in the current Hitlist table
    
$query "SELECT Month, Year, ProjectName, HitlistID, TotalValue, Status FROM Hitlist ";
    
$query $query."WHERE Month=$lMonth AND Year=$lYear AND UserID=$uUserID ";
    
$result odbc_do ($con$query);

    while ( 
odbc_fetch_into($result$row) != False )
    {
        
$tHitlistID $row[3];
        
$Status $row[5];

        
// Columns
        
$query1 "INSERT INTO Hit ";
        
$query1 $query1." (Stat) ";
        
// Values
        
$query1 $query1." VALUES ( '$Status' ) ";
        
odbc_do ($con$query1);

        echo 
"<br><TR bgcolor=$Col>\n";
        echo 
"<TD><A href=\"fd_form.php?HitlistID=".$row[3]."&action=edit&Key=".$Key."&lMonth=".$lMonth."&lYear=".$lYear."\">".$row[2]."</A></TD>\n";
        echo 
"<TD>".number_format($row[4],2)."</TD>\n";
        echo 
"<TD align=\"center\">$row[5]</TD>\n";
        echo 
"</TR>\n";
    }