Keith Spiller wrote:
> I am trying to figure out how to use the NOW() function with a MySQL
> Insert command on a Timestamp field.

Okey, either use NOW() on the DATETIME field, or use TIMESTAMP field
without inserting there value.

> Here is my mysql command:
>
> INSERT INTO $tablename
> (sender, recipient, whenread, whensent, subject,
>  messagetext, folder, priority, condition)
> VALUES
> ('$directorid', '$SendTo', '00000000000000', '$whensent',
>  '$SetSubject', '$MessageText', 'Inbox', '$SetPriority', 'TO')
> I want to use the NOW() function to set the current time in place of
> the $whensent variable.
> Can anyone help me?

If WHENSENT is TIMESTAMP, use:

INSERT INTO $tablename
(sender, recipient, whenread, subject, messagetext, folder, priority,
condition) VALUES
('$directorid', '$SendTo', '00000000000000',  '$SetSubject', '$MessageText',
'Inbox', '$SetPriority', 'TO')

If WHENSENT is DATETIME, use:
INSERT INTO $tablename
(sender, recipient, whenread, whensent, subject, messagetext, folder,
priority, condition) VALUES
('$directorid', '$SendTo', '00000000000000', NOW(), '$SetSubject',
'$MessageText', 'Inbox', '$SetPriority', 'TO')

--
./ premax
./ [EMAIL PROTECTED]



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to