获取上次更新时间mysqli(PHP) [英] Get last update time mysqli (PHP)
本文介绍了获取上次更新时间mysqli(PHP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试获取上次更新表的时间。
下面的代码返回-1或显示'命令不同步'错误
另外,我不确定什么是获取表格每行最后更新时间的最佳方法。
**上传新文件时表格被删除如果创建了新表。因此Create_Time。
我尝试过:
Trying to get the time when the table was last updated.
The code below returns either "-1" or shows 'Commands out of sync' Error
Also, I am not sure what's the best way to get the last updated time for each row of a table.
**Table gets dropped when a new file is uploaded and a new table if created. Thus Create_Time.
What I have tried:
$timeupdated = $db->multi_query('SELECT UPDATE_TIME FROM INFORMATION_SCHEMA.TABLES WHERE `TABLE_SCHEMA` = "dbname" AND `TABLE_NAME` = "tablename"');
if ($timeupdated == -1) echo "No Update Time Found"; //returns -1 without this
else{
$timecreated = $db->multi_query('SELECT CREATE_TIME FROM INFORMATION_SCHEMA.TABLES WHERE `TABLE_SCHEMA` = "dbname" AND `TABLE_NAME` = "tablename"');
echo $timecreated;}
echo $timeupdated;
推荐答案
timeupdated =
timeupdated =
db-> multi_query(' SELECT UPDATE_TIME FROM INFORMATION_SCHEMA.TABLES WHERE`TABLE_SCHEMA` =dbnameANDTABLE_NAME=tablename');
if (
db->multi_query('SELECT UPDATE_TIME FROM INFORMATION_SCHEMA.TABLES WHERE `TABLE_SCHEMA` = "dbname" AND `TABLE_NAME` = "tablename"'); if (
timeupdated == -1)echo 没有找到更新时间; //返回-1没有这个
其他 {
timeupdated == -1) echo "No Update Time Found"; //returns -1 without this else{
这篇关于获取上次更新时间mysqli(PHP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文