![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I have pages using AJAX and php to add data to MySQL database. What's the best way to add the date/time fror each addition of data? Thanks Geoff |
#3
| |||
| |||
|
|
Geoff Cox schreef: Hello, I have pages using AJAX and php to add data to MySQL database. What's the best way to add the date/time fror each addition of data? Thanks Geoff use the date/time from your server, not from 'any' client posting. |
#4
| |||
| |||
|
|
On Sat, 10 May 2008 09:36:40 +0200, Luuk <Luuk (AT) invalid (DOT) lan> wrote: Geoff Cox schreef: Hello, I have pages using AJAX and php to add data to MySQL database. What's the best way to add the date/time fror each addition of data? Thanks Geoff use the date/time from your server, not from 'any' client posting. Luuk, Thanks for your reply. I have just tried adding this to the php file and it seems to work OK. 1. in the php file $dt1 = date("Y-m-d H:i:s"); 2. to create in MySQL dt1 datetime NOT NULL default '0000-00-00 00:00:00', Is this not a good idea? How would I get the server date/time into MySQL? Cheers Geoff |
#5
| |||
| |||
|
|
Geoff Cox schreef: On Sat, 10 May 2008 09:36:40 +0200, Luuk <L... (AT) invalid (DOT) lan> wrote: Geoff Cox schreef: Hello, I have pages using AJAX and php to add data to MySQL database. What's the best way to add the date/time fror each addition of data? Thanks Geoff use the date/time from your server, not from 'any' client posting. Luuk, Thanks for your reply. I have just tried adding this to the php file and it seems to work OK. 1. in the php file $dt1 = date("Y-m-d H:i:s"); 2. to create in MySQL dt1 datetime NOT NULL default '0000-00-00 00:00:00', Is this not a good idea? How would I get the server date/time into MySQL? Cheers Geoff http://dev.mysql.com/doc/refman/5.0/...functions.html -- Luuk |
#6
| |||
| |||
|
|
On Sat, 10 May 2008 09:36:40 +0200, Luuk <Luuk (AT) invalid (DOT) lan> wrote: Geoff Cox schreef: Hello, I have pages using AJAX and php to add data to MySQL database. What's the best way to add the date/time fror each addition of data? Thanks Geoff use the date/time from your server, not from 'any' client posting. Luuk, Thanks for your reply. I have just tried adding this to the php file and it seems to work OK. 1. in the php file $dt1 = date("Y-m-d H:i:s"); 2. to create in MySQL dt1 datetime NOT NULL default '0000-00-00 00:00:00', |
|
Is this not a good idea? How would I get the server date/time into MySQL? |
#7
| |||
| |||
|
|
On Sat, 10 May 2008 10:26:50 +0200, Geoff Cox <gcox (AT) freeuk (DOT) notcom> wrote: On Sat, 10 May 2008 09:36:40 +0200, Luuk <Luuk (AT) invalid (DOT) lan> wrote: Geoff Cox schreef: Hello, I have pages using AJAX and php to add data to MySQL database. What's the best way to add the date/time fror each addition of data? Thanks Geoff use the date/time from your server, not from 'any' client posting. Luuk, Thanks for your reply. I have just tried adding this to the php file and it seems to work OK. 1. in the php file $dt1 = date("Y-m-d H:i:s"); 2. to create in MySQL dt1 datetime NOT NULL default '0000-00-00 00:00:00', I usually rather have NULLs for no data, then an invalid one (there is no year 0). Is this not a good idea? How would I get the server date/time into MySQL? NOW() |
![]() |
| Thread Tools | |
| Display Modes | |
| |