Adding ID in second Table
You can use LAST_INSERT_ID() to get the inserted id for example if you insert a row in your photos table and you need that auto incremented id for the detail table you can do so

INSERT INTO photos (purl, uid,`time`,title)
VALUES ( 'test',1,1111,'test');
INSERT INTO photodetail (pid, ptext, location)
VALUES (LAST_INSERT_ID(), 'test', 'test');


Fiddle Demo