I have a slight problem. I need to be able to determine the next auto_increment value for my primary key BEFORE I do a query. I can get this AFTER a query using: mysql_insert_id();
The reason for this is because I am uploading images and need to concatinate the unique id to the filename, insert this value into the database, then upload the file with the concatinated name.
I want to be able to do this with as little extra work (queries, filereads, etc) as possible.
I considered storing the value in a text file a reading/writing it everytime an insert is done, but this seems to be a waste of resources and time.
I also considered storing the filename to perform the upload after the query is done, but this causes a problem where the db would need an update query to correct the filename in the database. (Another waste of resources/time)
Does anyone have any suggestions?