Best way to go with multiple inserts

Best way to go with multiple inserts

Hi all.

Though only a home-taught novice in all, I am OK when it comes to using PHP and jQuery to insert records in a database. However, i am considering trying something that I am not sure is even possible (but assume it is) and hope someone can give me a pointer of which way to go.


Basically, I have written a script that generates scenario's to run through Selenium IDE and IBM's RFT. At the moment it just returns the info to screen but I want to save the runs into a MySQL database to be retrieved and run as and when needed.


The output table does 50 scenarios as standard and currently has over 100 variables but that would be split into separate tables during the insert process. so to give a pseudo example, if it was countries and I had the following data


Country, Capital, Population, Launguage
England, London, 1500000, English
France, Paris, 1000000, French


I would want to insert 'England' into a countries table
I would then want insert 'London, into a capitals table along with the $mysqli->insert_id from the 'Country' insert to link it
I would then want insert '1500000, into a population table along with the $mysqli->insert_id from the 'Country' insert to link it
I would then want insert 'English, into a language table along with the $mysqli->insert_id from the 'Country' insert to link it

Once that was done, I would want to do the same with the France row. I hope that makes as much sense as it does in my head!

This would be simple with PHP only but fear that it would strain the Windows Server VM it is being hosted on. Also, if a certain record fails to enter it would be a bit of a mess trying to find the offending record.

So (finally) why I am here. Would it be possible to use jquery in a loop to insert all rows and report back on each step ie.

INSERTING RECORD 1
ADDING ENGLAND TO COUNTRIES TABLE
SETTING ENGLAND CAPITAL TO LONDON 
SETTING POPULATION CAPITAL TO 1500000
SETTING LANGUAGE TO ENGLISH
FINISHED RECORD 1
INSERTING RECORD 2............

I will have a php loop anyway (which will generate each random row of records) and was thinking that I could call a jquery function on each iteration, but my issues are...

How do you post to a table without actually hitting a submit button?
After each step for each country, how would I pass the $mysqli->insert_id between separate inserts?
Am I over complicating it by wanting a status update at each step?
If an insert fails midway through a run, how can I automatically or manually remove everything that was successful from that run as it will be redundant?

If you have made it this far thank you. If you need any more info as to the set-up then let me know. I have not finalised how many tables the data will be split across but expecting it to be around 8. This really is still in the can I do it stage.

Thanks again and thanks in advance for any suggestions.

Regards
Steve