PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, January 13, 2022

[FIXED] Auto TimeStamp new entry to DB (phpMyAdmin)

 January 13, 2022     mysql, phpmyadmin, timestamp     No comments   

Issue

If I want each new entry into my db to be automatically timestamped, would I set the Field Type to "timestamp" and have the Default value set to "CURRENT_TIMESTAMP"?

Is this the correct method?


Solution

That is correct. In SQL code that would be:

CREATE TABLE `table` (
    ...
    `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, 
    ...
)


Answered By - BoltClock
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing