insert PHP date into MySQL

I’m trying to build a “member since” section for my webiste.

Basically, when a user registers, there is a disabled text box which displays todays date:

<?php $date = date('F j, Y'); echo""; ?>

and when you click register it take you to “reg_check.php” which checks the database for any repeat entries, and posts your information to it. It posts everything but the date, and since its not someting I’ve explored before, I was wondering what the best way to accomplish it was?

The reg_check looks like:

$sqlRegUser = “INSERT INTO
user( username, password, email, date )
VALUES(
'”. $username ."’,
‘". $password ."’,
‘". $email ."’,
‘". $date ."’
)";

Any help is appreciated.

MySQL accepts date in the format YYYY-MM-DD, so you need to use:

[php]$date = date(‘Y-m-d’);[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service