I\'m uploading image file to storage server. Before uploading I should compose filename, which contains AUTOINCREMENT VALUE in it (for example, 12345_filename.jpg).
The autoincrement value is generated by the database itself, when the insertion is done ; which means you cannot get it before doing the actual insert query.
The solution you proposed is not the one that's often used -- which would be :
where clause of the update query, to identify which row is being updated.Of course, as a security precaution, all these operations have to be made in a transaction (to ensure a "all or nothing" behavior)
As pseudo-code :
begin transaction
insert into your table (half empty values);
$id = get last autoincrement id
do calculations
update set data = full data where id = $id
commit transaction