MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 6th, 2000, 03:54 AM
chinnavi
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
I wanna add current date into my table whenever i inserts data into table i want to insert the current date into the table.

table design:

--->
create table HV
(
name varchar(25),
id integer(11) NOT NULL AUTO_INCREMENT,
date TIMESTAMP
)
---->
Now i have the table in my hand.
how can i insert current date?

vijay

Reply With Quote
  #2  
Old July 6th, 2000, 03:33 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
Since it's a timestamp you don't have to insert anything, it will automagically insert the current date/time when you insert/update a row. Also, since id is an auto_increment you don't need to insert there. Your insert statement can be:

insert into HV (name) values ('The Name');

or

insert into HV values('The Name',null,null);

One thing, you can't use 'date' as a field name. IIRC, 'date' is a reserved word.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > ADDING TIMESTAMP?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway