0

Hi,

I'm making a simple forum.

When a user register's, I trying to create their join date.

CREATE TABLE Users
(
	userName varchar(15) NOT NULL,
	registrationDate datetime default NULL
)

and then have MySQL automatically set that value:

$sql = "INSERT INTO Users (userName, registrationDate)
VALUES ('".$username."' , '".NOW()."')";

The program keeps failing though. when the PHP code is ran it says:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

Am I doing this right?

I think it may be my syntax, but I could be wrong.

Appreciate all help with this. :)

2
Contributors
2
Replies
5
Views
7 Years
Discussion Span
Last Post by Carrots
1

i'm pretty sure now() doesnt need quotes so

$sql = "INSERT INTO Users (userName, registrationDate)
VALUES ('".$username."' , NOW())";
Votes + Comments
Thanks buddy!
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.