Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 19th, 2006, 04:10 PM
Registered User
 
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default DATE / TIMESTAMP default values

hi im just new to mysql and is having problems with auto inserting date in my table.

I dont know what is the default value i will set if column type to DATE. It was succesful though if is use the TIMESTAMP type in the column and is using CURRENT_TIMESTAMP as the dafault value. mysql automatically inserts the current date and time to the database everytime a new record is inserted. The problem with using TIMESTAMP is that i only want the date and not the additional time.

Is there a default value I can use for the DATE function instead of using TIMESTAMP? I already tried NOW(), CURDATE(), CURRENT_DATE() to no avail :S

any suggestions will be much appreciated.


 
Old April 20th, 2006, 03:44 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

$time1=date("G:i:s");
INSERT INTO table1 (time) VALUES ('$time1')";
 
Old April 20th, 2006, 10:18 AM
Registered User
 
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for the info, i guess i can put the date value to a hidden field and pass it to the database. thanks again for the idea. :)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Default Field Values tachtenberg Reporting Services 1 February 19th, 2008 05:52 PM
setting default values prithvi28 XSLT 1 October 3rd, 2006 01:38 PM
Default values? Raymie_C Access VBA 2 May 16th, 2005 11:48 AM
Default Values davest Access VBA 2 October 19th, 2004 05:57 AM
Timestamp values and Access 2002 danielwajnberg Access 3 September 24th, 2003 12:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.