Welcome Guest, Not a member yet? Register   Sign In
Query build - insert NOW()
#5

(11-24-2016, 12:36 AM)sv3tli0 Wrote: Just to mark something..
Usually it's better to generate time including now , for insert or select within your PHP code.
It's not good to relate on both DB time and PHP time as they may have different settings and with that the time you are searching or inserting can mismatch..

Well, I am not using both. I am using only DB time both in my insert (using CURRENT_TIMESTAMP) and in my update.
Also, every "WHERE" I do that is related to time I use NOW or date methods, and for selecting I use UNIX_TIMESTAMP to get it back using a timestamp.

So I think I got all bases covered, for multiple timezones, multiple servers, and time differences, except for the insert method where if I want to insert NOW() I currently can't
Reply


Messages In This Thread
Query build - insert NOW() - by AmitMY - 11-23-2016, 04:34 AM
RE: Query build - insert NOW() - by InsiteFX - 11-23-2016, 05:26 AM
RE: Query build - insert NOW() - by Narf - 11-23-2016, 06:04 AM
RE: Query build - insert NOW() - by sv3tli0 - 11-24-2016, 12:36 AM
RE: Query build - insert NOW() - by AmitMY - 11-24-2016, 01:44 AM
RE: Query build - insert NOW() - by sv3tli0 - 11-24-2016, 02:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB