Hello,
I am trying to get the column names of the table with the PHP code below, but the problem occurs only in one table.
Is there something wrong with the php code or is there something wrong with the table?
Note: database piwigo album script
piwigo table
DROP TABLE IF EXISTS `groups`;
CREATE TABLE IF NOT EXISTS `groups` (
`id` smallint UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '',
`is_default` enum('true','false') NOT NULL DEFAULT 'false',
`lastmodified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `groups_ui1` (`name`),
KEY `lastmodified` (`lastmodified`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;
COMMIT;
Php code
$result = $db->query("SHOW COLUMNS FROM groups");
$result->fetchAll(PDO::FETCH_NUM)
Error message
Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups' at line 1 in \test3.php on line 39
Note: there is no data in the table