This is how is done using Oracle. I'm not sure in PHP.
You need to define a "sequence" first.
create sequence SEQ_NAME
increment by 1
start with 1
nomaxvalue
nocycle;
when insert you need something like this.
insert into TABLE_NAME ( id, name, sex)
values ( SEQ_NAME.nextval, 'HELLO', 'M');
Good luck,
Andrew