i haven't had that particular problem in PHP yet; something similar though: I once did a project in JSP with an IBM database.
The problem was that we needed the Primary Key of a row we inserted. Try what we might, we couldn't persuade the db to return that key without a new query (which was not possible at that point). So we used the following workaround: Instead of having the primary key be auto-increment, we had a separate table with counters for every table where auto generating the primary key wasn't possible.
The insertion looked something like this then:
Select nr_count from counters where countName = 'Unames';
insert into regUsers (ID, ....) values (nr_count + 1, ....);
update counters set nr_count = nr_count + 1 where countName = 'Unames';
The above aren't totally correct statements, but are probably better than the working code for getting the idea.
To avoid the overhead of needing a db connection every time we wanted to insert something, we incremented the counters in steps of 20. Also, be sure autocommit is off, because if any of the three statements has an error, the other two shouldn't modify the db.