get last oid is an old method, and since OIDs may one day go away, are not the best methods.
What you want to do in Postgresql is to use the sequence functions currval and nextval. these functions work as follows:
nextval('seqname') returns the next available value of the sequence and increments it all at once.
currval('seqname') returns the most recently returned value WITHIN THIS SESSION of the sequence. currval is not set until nextval (or setval) have been called during the current session.
Method 1:
$q1 = select nextval('seqname');
insert into table (id, info) values ($q1,'text goes here');
insert into child_table (pid, moreinfo) values ($q1,'even more text');
Method 2:
insert into table (info) values ('text goes here');
$q1 = select currval('seqname');
insert into child_table (pid,moreinfo) values ($q1,'even more text');