cancel
Showing results for 
Search instead for 
Did you mean: 

Database Manager and default datetime values

primming
Member

Hi there,

 

I am trying to have a default value put into a date/time field. I can't find a way to do this using the database manager. Can you tell me how this can be done please?

 

Thanks

Phil.

1 ACCEPTED SOLUTION

Accepted Solutions

pmillman
Power User

Hi,

I don't believe you are able to use a default value of NOW().

Rather than having two hidden form fields, I would make my INSERT statement (using PHP for the example) as follows:

 

$query = "INSERT INTO table (field, messageDated) VALUES( \"".$value1."\", NOW() )";

 

I have to confess I haven't tried this yet myself, but I would be interested to hear how it works for you.

 

Peter

 

 

View solution in original post

1 REPLY 1

pmillman
Power User

Hi,

I don't believe you are able to use a default value of NOW().

Rather than having two hidden form fields, I would make my INSERT statement (using PHP for the example) as follows:

 

$query = "INSERT INTO table (field, messageDated) VALUES( \"".$value1."\", NOW() )";

 

I have to confess I haven't tried this yet myself, but I would be interested to hear how it works for you.

 

Peter