Tell me please, there is a code that checks the last id in the table.
<?php $host = 'localhost'; $db = ''; $user = ''; $pass = '; $charset = 'utf8'; $dsn = "mysql:host=$host;dbname=$db;charset=$charset"; $opt = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false, ]; $pdo = new PDO($dsn, $user, $pass, $opt); $stmt = $pdo->query('SELECT MAX(id) FROM users'); while ($row = $stmt->fetch()) { echo $row['id']; } ?> But echo does not output anything. error log displays
PHP Notice: Undefined index: id in / home/fun/test.php on line 17
echo $row['MAX(id)'];orecho $row['`MAX(id)`'];(I do not know how correctly in PHP, it is necessary to try ...). - Akina