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 ) Code (markup): and then have MySQL automatically set that value: $sql = "INSERT INTO Users (userName, registrationDate) VALUES ('".$username."' , '".NOW()."')"; Code (markup): The program keeps failing though. when the PHP code is ran it says: Am I doing this right? I think it may be my syntax, but I could be wrong. Appreciate all help with this.
Try: $sql = "INSERT INTO `Users` (`userName`, `registrationDate`) VALUES ('" . $username . "', NOW())"; PHP:
Hey thanks for helping. Am I blind? But my actual line looks the same as yours, but it still keeps on saying it. $sql = "INSERT INTO Users (userName, firstName, lastName, emailaddress, password, passwordsalt, registrationIP, registrationDate) VALUES ('".$username."' , '".$firstname."' , '".$lastname."' , '".$emailaddress"' , '".$passhash."' , '".$salt."' , '".$registrationip."' , NOW())"; Code (markup): The NOW() is right at the end. +ve rep's, thanks!