what i want to achieve is that when people sign up i want to have the date entered into my database
so far all i done is create a regdate feild to the database the "type" i used is "date"
not sure what the code would be, please help or direct me to a tutorial that explains how and what to do
pinkangel_@hotmail.co.uk
registration date added to registering
Moderator: General Moderators
-
chris_s_22
- Forum Commoner
- Posts: 76
- Joined: Wed Dec 31, 2008 2:05 pm
-
mattpointblank
- Forum Contributor
- Posts: 304
- Joined: Tue Dec 23, 2008 6:29 am
Re: registration date added to registering
You need to add some code to your registration process so that when the user's info is stored in the database, it also includes the current date, which you can get using php's date() function. You'd just need to add this into the SQL query that's adding the data.
On the other hand, if you add a field with the type 'timestamp' on your database (assuming you're using MySQL), it will automatically set itself to the date the row was updated, without any input from you.
On the other hand, if you add a field with the type 'timestamp' on your database (assuming you're using MySQL), it will automatically set itself to the date the row was updated, without any input from you.
Re: registration date added to registering
Can't you just put NOW() into the mysql statement for the current date?mattpointblank wrote:You need to add some code to your registration process so that when the user's info is stored in the database, it also includes the current date, which you can get using php's date() function. You'd just need to add this into the SQL query that's adding the data.
On the other hand, if you add a field with the type 'timestamp' on your database (assuming you're using MySQL), it will automatically set itself to the date the row was updated, without any input from you.
-
mattpointblank
- Forum Contributor
- Posts: 304
- Joined: Tue Dec 23, 2008 6:29 am
Re: registration date added to registering
Oops, yeah, that too.
-
chris_s_22
- Forum Commoner
- Posts: 76
- Joined: Wed Dec 31, 2008 2:05 pm
Re: registration date added to registering
thx for your replys guys i ended up using this
this works, just wanted to check with you guys if there was a reason why this was incorect or any reason why i shouldnt do it this way
Code: Select all
// Get the current date
$regdate=date("Y-m-d");
// And then this to store the information in the database
$query = "insert into user (regdate) values (''$regdate')";
this works, just wanted to check with you guys if there was a reason why this was incorect or any reason why i shouldnt do it this way