Thank you,
How would I do the insert statement in php using a date() or now()
function?


-----Original Message-----
From: John W. Holmes [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 15, 2003 4:13 PM
To: 'Jeremi Bergman'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Insert Date

> I'm having problem inserting the date into my mysql database.  What
type
> of field should my date field be?
> How do I insert that into a database, the current date for example?
> "INSERT INTO tblDate (fldDate) VALUES (" . Date() . ")";

You should use a DATE column, maybe?? Or a timestamp, depending on what
you want to do.

The query you'd use is:

INSERT INTO tblDate (fldDate) VALUES (NOW())

where NOW() is a MySQL function, not a PHP one. MySQL date formats are
YYYYMMDD (as an integer) or YYYY-MM-DD (as a string). 

Adapt to your needs.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to