在我页面的页脚中,我想添加诸如上次更新 xx/xx/200x"之类的内容,此日期是某个 mySQL 表的最后一次更新时间.
In the footer of my page, I would like to add something like "last updated the xx/xx/200x" with this date being the last time a certain mySQL table has been updated.
最好的方法是什么?是否有检索上次更新日期的功能?每次需要这个值时都应该访问数据库吗?
What is the best way to do that? Is there a function to retrieve the last updated date? Should I access to the database every time I need this value?
在更高版本的 MySQL 中,您可以使用 information_schema 数据库来告诉您另一个表何时更新:
In later versions of MySQL you can use the information_schema database to tell you when another table was updated:
SELECT UPDATE_TIME
FROM information_schema.tables
WHERE TABLE_SCHEMA = 'dbname'
AND TABLE_NAME = 'tabname'
这当然意味着打开与数据库的连接.
This does of course mean opening a connection to the database.
另一种选择是在更新 MySQL 表时触摸"特定文件:
An alternative option would be to "touch" a particular file whenever the MySQL table is updated:
关于数据库更新:
O_RDRW 模式打开时间戳文件关闭再次O_RDRW modeclose it again或者替代
touch(),与 utimes() 函数等效的 PHP 函数,用于更改文件时间戳.touch(), the PHP equivalent of the utimes() function, to change the file timestamp.页面显示:
stat()回读文件修改时间.stat() to read back the file modification time.这篇关于如何判断 MySQL 表的上次更新时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何有效地使用窗口函数根据 N 个先前值来决定How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函数根据
在“GROUP BY"中重用选择表达式的结果;条款reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用选择表达式的结果;条款?)
Pyspark DataFrameWriter jdbc 函数的 ignore 选项是忽略整Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函数的 ig
使用 INSERT INTO table ON DUPLICATE KEY 时出错,使用 Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 时出错,使用 for 循环数组
pyspark mysql jdbc load 调用 o23.load 时发生错误 没有合pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 调用 o23.load 时发生错误 没有合适的
如何将 Apache Spark 与 MySQL 集成以将数据库表作为How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何将 Apache Spark 与 MySQL 集成以将数据库表作为