root@localhost [project_db]> describe articles_table; +------------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+--------------+------+-----+---------+-------+ | db_art_id | bigint | YES | MUL | NULL | | #### root@localhost [project_db]> SELECT MAX(db_art_id) FROM articles_table; [...] +----------------+ | MAX(db_art_id) | +----------------+ | 1 | +----------------+ 1 row in set (0.01 sec) root@localhost [project_db]> #### 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 'FROM articles_table' at line 1 #### 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 '"articles_table"' at line 1 #### my $my_articletable = 'articles_table'; my $p_db_art_id = 'db_art_id'; my $sqlcmd = "SELECT MAX($p_db_art_id) FROM $my_articletable;"; logit("SQLCMD: '$sqlcmd'"); my $sth = $p_dbh->prepare($sqlcmd); $sth->execute();