how are you determining that the insert has failed?
Are you looking in the MySQL Database directly to see if the record has been inserted?
or are you relying on the out put on the page to see the inserted data?
if you are relying on the output on the page, it is most likely that the insert is working fine, it's just that the order of the code is to create the recordset on the page before the record is inserted.
since the recordset is created before inserting the new record, the new record does not exist in the recordset, so ant be displayed on the page until the next time the page is loaded.