我有一个MySQL db,表中包含每2-4小时从源加载的数据,我目前正在输入表最后更新的时间。目前它是用load data local infile replace into mytable更新的,所以数据自动加载到cron中,我只想在上次更新数据时显示在html表下面。

我尝试过update_time和information.schema,但是没有显示任何东西,它只是在我希望它出现的区域中显示空白。
下面是我尝试过的一个查询,它看起来很简单,而且更好,但只显示空白的白色页面。
<?php
$connection = mysql_connect('host', 'user', 'password');
mysql_select_db('db');
$query= "SHOW TABLE STATUS LIKE 'count_page'"; $result=mysql_query($query);
if (mysql_num_rows($results)> 0) {
$rst=mysql_fetch_arry($result); print $rst['Update_time'];
} else {
print 'These arent the droids youre looking for';
}
mysql_close();
?>发布于 2013-12-03 18:24:08
您可以创建包含最后更新日期的文本文件。将此添加到cron文件中:
file_put_contents('date.txt', date('m/d/Y/g:iA'));然后将其放到您的表中,在其中显示要添加最后更新日期的脚本。
echo '<b>Data Last Updated : (' . file_get_contents("date.txt") . ')</b>';您可以始终将额外的时间戳列放置到表中并使用它,但这是一种方法。
https://stackoverflow.com/questions/20358576
复制相似问题