Help - Search - Member List - Calendar
Full Version: datetime in mysql
WorkTheWeb Forums > Webmaster Resources > PHP Help
Support our Sponsors!
Mark D Smith
Hi

i am inserting various values in a mysql table via php. now the ID is auto
increment but how do i get the datetime to update when i post the values to
say the new ID (row) that my "INSERT INTO / VALUES sql statement has just
preformed?

i can format a string for the datetime and send that with the insert but
just wondering if there is a shortcut.

Mark

Colin McKinnon
Mark D Smith wrote:

QUOTE
Hi

i am inserting various values in a mysql table via php. now the ID is auto
increment but how do i get the datetime to update when i post the values
to say the new ID (row) that my "INSERT INTO / VALUES sql statement has
just preformed?

i can format a string for the datetime and send that with the insert but
just wondering if there is a shortcut.


erm...

INSERT INTO myTable (dateField) VALUES (now());

Go get a copy of the MySQL manual - there's a whole load of functions for
working with dates/times in MySQL

C.

Mark D Smith
"Colin McKinnon" <[Email Removed]> wrote in message
news:d9ravh$jaa$1$[Email Removed]...
QUOTE
Mark D Smith wrote:

Hi

i am inserting various values in a mysql table via php. now the ID is
auto
increment but how do i get the datetime to update when i post the values
to say the new ID (row) that my "INSERT INTO / VALUES sql statement has
just preformed?

i can format a string for the datetime and send that with the insert but
just wondering if there is a shortcut.


erm...

INSERT INTO myTable (dateField) VALUES (now());

Go get a copy of the MySQL manual - there's a whole load of functions for
working with dates/times in MySQL

C.

works like a dream, note comment on manual will get round to it.

thanks

Mark


PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2006 Invision Power Services, Inc.