Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Time added to database
#1
Hi,

Is it possible to fetch the time that a form was submitted to the database? When I submit my form to my database, it displays in a table - is it possible to display the time that it was added?

Let me know if I need to explain more.

Thanks
Reply
#2
Yes it is!
In your table you need to create an extra field, type "DATE" or "DATETIME" or "TIMESTAMP"
If you use time stamp you can create a field with this command
Code:
`update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,

The entry would look like, update_time = 2009-12-31 00:55:55

Or you can also use a PHP function "date()"

PHP Code:
$stamp date("Y.d.m H:i:s"); // TYPE: DATETIME
$stamp date("Y.d.m"); // TYPE: DATE
$stamp date("H:i:s"); // TYPE: TIME 

And just pass the $stamp along with other variables to your DB.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Submit Textfile Contents To Database xbiohazardx 13 3,667 12-06-2010, 01:28 AM
Last Post: Chimi
  PHP automatically create new database after x tables Dutchcoffee 5 1,296 02-25-2010, 05:35 PM
Last Post: Dutchcoffee

Forum Jump:


Users browsing this thread: 1 Guest(s)