If your application is the only thing touching the database, you could write a php function to basically do the same thing. Just create a single row single column table that holds the auto-inc value, (i.e. af) then you lock it, read it, increment it, write it back out, and then use that in your insert query to the actual data holding table.