0

How can I make a "timestamp" of time when I change something inside of cell in mysql and echo it in PHP?

exemple

$Notificare1 = "<p><span>Notificare1 cell has been modified ago 2 hours / 3 depends. </span></p>";}

echo $Notificare1

I tried to make a countdown timer, but it doesn't show in the moment of changing the value.

I tried to do with SELECT CURRENT_TIMESTAMP; but it didn't work neither.

Sterling Archer
  • 22,070
  • 18
  • 81
  • 118
  • 1
    No matter how many times I re-read that, I just do not know what it is you are trying to ask for (or accomplish). – IncredibleHat Mar 30 '18 at 18:05
  • I want to get timestamp of the time when I change a value inside of mysql. –  Mar 30 '18 at 18:07
  • Currently my code gives a notification from admin and below his text it shows timestamp of when notification appeared. But I can't manage that timestamp. –  Mar 30 '18 at 18:09
  • Or tell them to look at their watch. Sounds more like you should add 'created' and 'modified' columns to your table... https://stackoverflow.com/questions/267658/having-both-a-created-and-last-updated-timestamp-columns-in-mysql-4-0 – ficuscr Mar 30 '18 at 18:16
  • @ficuscr `LastUpdated` TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP, sounds good, thank you. I will try to modify my rows with that, If I can. –  Mar 30 '18 at 18:18
  • I try and let the database manage timestamps. Addresses issues with sync from multiple clients and anything/anyone else with their hooks in the DB outside your application space. – ficuscr Mar 30 '18 at 18:22
  • @ficuscr I just needed to echo time without creating new cell for "TimeofNotification1" and inserting time there, and later echo "You received this at 20:00 30/Mar/2018. Now I created ToN1 cell and updated it with timestamp –  Mar 30 '18 at 18:23
  • Well as stated, in that use case you could just fudge it and return current time. What if you want to look back today though at when something changed tomorrow? Usually just refresh entity from database and reference the modified timestamp... Close as dupe maybe if that link helped. – ficuscr Mar 30 '18 at 18:25
  • Answer the link so I can select it as the best answer –  Mar 30 '18 at 18:28

0 Answers0