Home > Archive > MySQL ODBC Connector > September 2005 > mysql/php date functions..









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author mysql/php date functions..
bruce

2005-09-26, 1:23 pm

hi...

i've got a question/problem that i can't seem to figure out. it should be
simple/straightforward.

i'm creating a test tbl
id int
t1 timestamp

when i do a 'select * from tbl' i get what looks like a default date/time
format in the timestamp column.

i do a, (from mysql)
'insert into tbl (id, t1) values (1, 333333)' and it fails...

i do a,
'insert into tbl (id, t1) values (1, now())' and it works...

after i do the 'now()', i see what also looks like a date/time format in the
timestamp column.

any ideas/comments/thoughts as to what might be going on...

thanks...

ps. my goal is to create a quick/test php app where i can use the php
'time()' functin and insert it into the mysql tbl!!!



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

gerald_clark

2005-09-26, 8:24 pm

bruce wrote:

>hi...
>
>i've got a question/problem that i can't seem to figure out. it should be
>simple/straightforward.
>
>i'm creating a test tbl
> id int
> t1 timestamp
>
>when i do a 'select * from tbl' i get what looks like a default date/time
>format in the timestamp column.
>
>i do a, (from mysql)
> 'insert into tbl (id, t1) values (1, 333333)' and it fails...
>
>

333333 is not a valid date/time.
Did you try :
'insert into tbl (id) values (1)' ?

>i do a,
> 'insert into tbl (id, t1) values (1, now())' and it works...
>
>after i do the 'now()', i see what also looks like a date/time format in the
>timestamp column.
>
>any ideas/comments/thoughts as to what might be going on...
>
>

Yes, it is working.

>thanks...
>
>ps. my goal is to create a quick/test php app where i can use the php
>'time()' functin and insert it into the mysql tbl!!!
>
>

Why? Timestamps update themselves. You don't need to insert them.
You might try reading the manual for a description of how timestamp works.

>
>
>
>



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com