note 63765 added to function.microtime
| From: | me at whereever dot com | Date: | Thu, 30 Mar 2006 09:34:44 +0000 |
| Subject: | note 63765 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107001@lists.php.net to get a copy of this message | ||
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
----
Server IP: 64.71.164.2
Probable Submitter: 62.23.212.63
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- http://master.php.net/note/edit/63765
Del: integrated -- http://master.php.net/note/delete/63765/integrated
Del: useless -- http://master.php.net/note/delete/63765/useless
Del: bad code -- http://master.php.net/note/delete/63765/bad+code
Del: spam -- http://master.php.net/note/delete/63765/spam
Del: non-english -- http://master.php.net/note/delete/63765/non-english
Del: in docs -- http://master.php.net/note/delete/63765/in+docs
Del: other reasons-- http://master.php.net/note/delete/63765
Reject -- http://master.php.net/note/reject/63765
Search -- http://master.php.net/manage/user-notes.php