AustNet AustNet Archive Project — IRC Logs
« All channels | Contribute a log »

// #php — 2007-10-02

1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
00:06:01 Nick: drexen is now known as drexen[a]
00:12:50 Nick: drexen[a] is now known as drexen
00:13:02 Quit: MedNez1 ([email protected]) Exit: Get MacIrssi - http://www.g1m0.se/macirssi/
00:25:03 Quit: Reprobait ([email protected]) Exit: Leaving
00:28:48 Nick: drexen is now known as drexen[a]
00:51:04 Nick: drexen[a] is now known as drexen
01:47:07 Quit: Kryten ([email protected]) Ping timeout for Kryten
02:57:01 Nick: drexen is now known as drexen[a]
03:48:40 Join: Kryten ([email protected]) to #php
03:49:05 Mode: (by php) +v Kryten
05:05:38 Quit: drexen[a] ([email protected]) Ping timeout for drexen[a]
05:15:29 Join: drexen[a] ([email protected]) to #php
05:15:46 Nick: drexen[a] is now known as drexen
05:17:56 Nick: drexen is now known as drexen1
05:21:06 Quit: drexen1 ([email protected]) Ping timeout for drexen1
05:25:10 Join: drexen ([email protected]) to #php
05:25:11 Mode: (by ChanOp) +v drexen
05:48:29 Quit: robert_ ([email protected]) Read error to robert_: EOF from client
05:50:09 Join: robert_ ([email protected]) to #php
05:50:31 Mode: (by php) +v robert_
05:51:44 Quit: robert_ ([email protected]) Read error to robert_: EOF from client
05:54:01 Join: robert_ ([email protected]) to #php
05:54:17 Mode: (by php) +v robert_
07:58:31 Join: smythe ([email protected]) to #php
08:15:41 Join: paveway-3 ([email protected]) to #php
08:15:42 Quit: paveway ([email protected]) Read error to paveway: Connection reset by peer
09:46:18 Quit: paveway-3 ([email protected]) Read error to paveway-3: Connection reset by peer
09:46:20 Join: paveway ([email protected]) to #php
12:10:07 Join: Lish ([email protected]) to #php
12:10:23 Mode: (by php) +v Lish
12:15:22 Quit: Lish ([email protected]) Exit: Lish has no reason
13:00:30 Join: paveway-3 ([email protected]) to #php
13:01:21 Quit: paveway ([email protected]) Read error to paveway: Connection reset by peer
13:37:54 Quit: keenly ([email protected]) Ping timeout for keenly
13:41:33 Quit: drexen ([email protected]) Exit:
14:00:39 Quit: BJ ([email protected]) Ping timeout for BJ
14:01:21 Quit: php ([email protected]) Read error to php: Connection reset by peer
14:20:36 Join: BJ ([email protected]) to #php
14:20:38 Mode: (by ChanOp) +o BJ
15:29:54 <BJ> mm
15:30:57 Join: php ([email protected]) to #php
15:30:57 Mode: (by ChanOp) +o php
15:31:08 Mode: (by php) +e
15:32:20 <BJ> hjrm
15:32:22 Mode: (by BJ) -e
15:59:49 Quit: smythe ([email protected]) Exit: Austnet Chat Network
16:22:52 Join: drexen ([email protected]) to #php
16:22:54 Mode: (by ChanOp) +v drexen
17:03:00 Join: Loserbait ([email protected]) to #php
17:33:10 Join: keenly ([email protected]) to #PHP
18:35:50 Quit: drexen ([email protected]) Exit: Austnet Chat Network
20:05:10 Join: serbianking ([email protected]) to #php
20:08:10 <serbianking> hey guys, just a quick question, how would i get the next auto increment value of a field?
20:09:27 <eyecue> http://au3.php.net/mysql_insert_id
20:13:43 <serbianking> cheers
20:17:52 <serbianking> is there a possability of getting the id before you do a query?
20:18:59 <eyecue> you could select the field you want, of course
20:19:10 <eyecue> as you normally would trying to get anything out of a database
20:19:38 <serbianking> could be done by getting the max value of the increment field + 1?
20:19:50 <eyecue> why + 1 ?
20:20:00 <eyecue> get the current value, the insert + 1
20:20:01 <serbianking> well im looking for the next value
20:20:08 <eyecue> there is no next value
20:20:11 <eyecue> theres only current
20:20:44 <serbianking> i need the next because i need to define a file name according to the increment value but i cant set the file name if i dont have the value of the id
20:20:47 <eyecue> plus that can change at any time, especially given deleted/updates/reindexed tables, etc
20:20:56 Join: Lish ([email protected]) to #php
20:21:02 <Lish> dont exercise
20:21:02 <eyecue> why would you introduce that kind of logic instead of just generating a filename ?
20:21:05 <Lish> its bad for you
20:21:12 <eyecue> youre linking to something that doesnt need to be linked
20:21:15 Mode: (by php) +v Lish
20:22:10 <eyecue> you're introducing a whole logic sequence to avoid the use of an additional field
20:22:31 <eyecue> and youre doing it out of mysql, where fields/records are the bread and butter of db's
20:23:04 <eyecue> Note: The value of the MySQL SQL function LAST_INSERT_ID() always contains the most recently generated AUTO_INCREMENT value, and is not reset between queries.
20:23:16 <serbianking> i want the file structure to have the id of the field stored in the database as a reference point for the file
20:23:40 <eyecue> i understand what youre trying to do, but what is the 'requirement' that the filename be the id
20:23:52 <Lish> dull
20:23:53 <Lish> :(
20:25:13 <serbianking> the file name will contain a date (2007-10-02) but since there are going to be hundreds of files with the same date it would be easier for the files to also have the field id attached so that no complications occure when defining file names
20:25:32 <eyecue> Why not use a timestamp ?
20:25:47 <eyecue> or datestamp, or datestamp + index, or datestamp+microseconds
20:26:19 <eyecue> auto_inc fields are unreliable, and youre trying to use an unreliable feature, and unreliable logic to increase reliability, or at least avoid problems with uniqueness
20:27:03 <eyecue> if you really want to do what you're thinking of doing. read mysql's page on mysql_insert_id
20:27:37 <eyecue> if youre a smart fella, you'll use something that can guarantee uniqueness across time/space, use either UUID generation function, or datestamp+microseconds
20:27:44 <eyecue> all of which are available as native functions in php
20:27:46 <serbianking> is there a way of applying a query so that it inserts the file name as such "2007-10-02 + autoinc_field
20:28:14 <eyecue> *rolls eyes*
20:29:25 <serbianking> sorry to be a pain in the ass, but ive got to make this work since there is a bit of ajax/javascript in this and there will be about 100+ files uploaded at the same time...
20:29:35 <eyecue> so?
20:29:43 <eyecue> then you dont want to lock around the auto inc column anyway
20:29:52 <eyecue> you'll get race conditions up the wazoo
20:30:01 <eyecue> use UUID's
20:30:06 <serbianking> so you think date+timestamp is a good solution?
20:30:07 <eyecue> they guarantee uniqueness
20:30:23 <eyecue> i think your autoinc idea is one of the worst solutions
20:30:31 <serbianking> lol thanks :(
20:30:36 <eyecue> im being honest
20:30:42 <serbianking> nah thats fair enough
20:30:47 <eyecue> do you want it to break because you were such a hard arse about how you do things?
20:31:09 <eyecue> microseconds gets you .0001 resolution
20:31:10 <serbianking> i would rather it not break
20:31:56 <eyecue> datestamp+microtime would suffice
20:31:58 <eyecue> but even then
20:32:07 <eyecue> i would add a single check to whether a file exists or not.
20:32:26 <serbianking> i see
20:32:40 <eyecue> thats a lot easier, and more reliable than what youre talking aout
20:33:09 <eyecue> uuid's gurantee uniqueness, microtime will get away with it 99.999999999999999999999% of the time
20:33:48 <serbianking> ok ill have a look at uuid's otherwise from what you say date+microtime would do
20:39:25 <serbianking> ok this seems like a good enough idea: date+uniqid() & single check to make sure file doesnt exist?
20:42:28 <eyecue> looks fine
20:42:49 <eyecue> make sure you use the more entropy option
20:43:04 <serbianking> thanks heaps :)
20:43:32 <eyecue> http://au3.php.net/uniqid
20:43:39 <eyecue> also, read the comments on that page
20:43:45 Quit: Lish ([email protected]) Ping timeout for Lish
20:44:19 <serbianking> cheers
20:52:06 Quit: serbianking ([email protected]) Exit:
21:16:01 Quit: rofo ([email protected]) Ping timeout for rofo
21:23:50 Join: Lish ([email protected]) to #php
21:24:14 Mode: (by php) +v Lish
22:20:22 Quit: Lish ([email protected]) Exit: Lish has no reason
23:10:50 Join: rofo ([email protected]) to #php
23:10:53 Mode: (by ChanOp) +o rofo
23:10:58 Mode: (by php) +v rofo