You could try something like this :
Code:
begin transaction
insert parent ( id, parent_data ) values ( null, "parent_data" );
insert child ( id, parent_id, child_data ) values( null, mysql_insert_id(), "child_data" );
commit transaction
I don't know anything about your application but I think a function wouldn't be a bad idea for inserting the parent. The function would insert the parent and then return the id of the parent. Each process would use this value when adding it's children. Also if there is little difference between a parent and a child I'd say use the same table and hence the same function to add these as well.
Code:
select add_item( null, "parent_data" ) into v_parent_id;
select add_item( v_parent_id, "child_data_1" );
select add_item( v_parent_id, "child_data_2" );