#1
  1. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)
    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
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    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.

Similar Threads

  1. Monitor change in modified image's timestamp
    By christinewang in forum Perl Programming
    Replies: 8
    Last Post: February 16th, 2011, 01:22 PM
  2. Inaccurate timestamp
    By duckumu in forum PHP Development
    Replies: 1
    Last Post: September 14th, 2003, 05:30 PM
  3. Replies: 0
    Last Post: May 5th, 2003, 06:59 AM
  4. incorrect sorting of Unix timestamp
    By vladiator in forum MySQL Help
    Replies: 2
    Last Post: October 12th, 2001, 02:42 PM
  5. ADDING TIMESTAMP?
    By chinnavi in forum MySQL Help
    Replies: 0
    Last Post: July 6th, 2000, 03:52 AM

IMN logo majestic logo threadwatch logo seochat tools logo