Jump to content

Automatically inserting time/date into database?


aaricwon

Recommended Posts

======|RowID|Subject|SStory|FStory|DatePosted=========

 

===============================================

 

RowID = Primary, Auto_increment

DatePosted = TYPE:timestamp

 

I think this is the very easiest way to insert automatically the current time and date after you have posted. But there are so many ways.. ;)

 

Regards

You know, I don't know whats up but my TIMESTAMP to current_timestamp never works. My INSERT stops working so I had to do a format in PHP to get inserted into an INT. Maybe I'm just doing it wrong. Do I put anything in the INSERT or put a NULL or NOW() or don't even put a value for the TIMESTAMP. None of them work for me

hi, no need to put a value for a timestamp in the structure of your table. ex. namefield simply use timestamp. so in your php page no need to insert date to save because automatically the current time and date of your system save in your dbase after you have inserted some data's. but make sure try to create field for your primary key. ex rowid TYPE int, auto_increment.

 

========= |rowid| name | date_posted | ==========

                  001    John  00,00,00 00:00:00

                  002    Allan  00,00,00 00:00:00

==========================================

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.