PHP MySQL display table last updated date
PHP MySQL display table last updated date
PHP MySQL display table last updated date
It has always become a requirement for the web developers to display the dates on which their website record was recently updated or the last date when a user has posted some comments etc.,
This can be accomplished easily with mysql and php.
We are using simple mysql query to select the record from the database and with the help of php mysql_fetch_array function displaying the date.
Here goes the code. I am not giving the entire mysql connection information as i assume that you guys are good in getting connection code for mysql 😛 . if not please let me know i can provide more info on that on this website.
$qry = "SELECT MAX(<COLUMN_NAME_OF_TABLE>) FROM <TABLE_NAME>"; $result = mysql_query($qry) or die(mysql_error()); $date = mysql_fetch_array($result); echo "The Record Was Last Updated On ".$date[0];
Here COLUMN_NAME_OF_TABLE is your mysql table column name
TABLE_NAME is name of the table from which your are fetching the information.
This is just a simple example. You can play around and do modifications according to your requirement.
PHP MySQL display table last updated date,