Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use phpMyAdmin or MySQL to check when a record was made or modified without a timestamp column?

Scenario.

Simple database which has a list of addresses

addressID
FirstName
LastName
City
PostCode
CountyID
ZoneID

The problem is that by default this table doesn't have a creation or timestamp column at the end. However I have full access to MySQL through my Nginx SSH Ubuntu 11 setup - I can also login to root phpMyAdmin.

Can I check for example when a particular entry was made, modified etc ?

like image 748
TheBlackBenzKid Avatar asked Oct 06 '22 20:10

TheBlackBenzKid


1 Answers

In short, no. This is not impossible 99% of the time. Especially in the environment being MySQL. NoSQL and other services like MongoDB and other environments differ.

Run this script in phpMyAdmin for future use now (you already suggested you were going to make a stamp record).

ALTER  TABLE Addresses
ADD Column CreatedOrModified timestamp
NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;

You can also use the NULL and also DateTime Stamp for the default values. You can also have PHP send the Data inside the MySQL field:

$stamp=$date=date("Y-m-d H:i:s"); 
like image 134
M1th Avatar answered Oct 13 '22 00:10

M1th