note 63765 deleted from function.microtime by tularis
| From: | tularis@php.net | Date: | Sun, 22 Jun 2008 12:11:02 +0000 |
| Subject: | note 63765 deleted from function.microtime by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-140685@lists.php.net to get a copy of this message | ||
Note Submitter: me at whereever dot com
----
Just to say that what "junk" said about using the timestamp for indexes does make sense in
some situations. For instance, I have a deliverables management page that does 2 things:
1) FTP transfer of the file to the server. This operation requires the file to be transfered to a
directory specific to that one delivery
2) Create an entry in database with all the details of the delivery, including the filepath for
download purposes.
If I wanted to use the auto increment function, there would be no way for me to know the index of
the DB entry before actually doing the insert. So to work consistently I would have to do:
DB insert -> Fetch the index value -> Try to upload the file -> if transfer fails: delete
DB entry
With timestamp it would look like this:
Compute timestamp -> Try file transfer -> DB insert if transfer OK
The choice is yours I guess