PHP Mysql Get Table Last Updated Time & Date
one text
Solution:
the mysql family of functions is removed in PHP 7 As far as I know. You may only use mysqli and pdo. I recommend switching to PDO, as it has more flexibility. See the mysql requirements. Assuming that you have transitioned to PDO, you can use the following code to achieve the same thing:
//select the appropriate database
$pdo_object->query('use information_schema');
$query1 = "SELECT 'UPDATE_TIME' FROM 'TABLES' WHERE 'TABLE_SCHEMA' LIKE 'demo' AND 'TABLE_NAME' LIKE 'usc'";
$query1 = $pdo_object->prepare($query1);
$query1->execute();
while($row = $query1->fetchAll(PDO::FETCH_ASSOC)) {
echo "<font color='red'> (Last update : ".$row['UPDATE_TIME'].")</font>";
}
The aforementioned code also mitigates the MySQL Injection vulnerabilities that your code may be exposed to.
Source