Re: Inserting current date(MySQL)?
| From: | 1LT John W. Holmes | Date: | Wed, 30 Oct 2002 19:11:52 +0000 |
| Subject: | Re: Inserting current date(MySQL)? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-22826@lists.php.net to get a copy of this message | ||
> I'm my trying to insert to current date from a php form? I know that
> MySQL has a CURDATE() fucntion and PHP has several date function, but I
> cann't seem to get either to work? Here is my existing code:
> $ADDDATE=date("Y-m-d");
[snip]
> VALUES ('$_POST[ADDDATE]',
You've got two different variables there. You should just use $ADDDATE in
your query.
Or, like you said, just use CURDATE() or NOW() in your query.
VALUES (NOW(), ...
VALUES (CURDATE(), ...
---John Holmes...