0

Why placing a "?" in front of "FROM" does not work, while in other places it works?

query = "SELECT nome_cliente 
         FROM ?
         ORDER BY nome_cliente";

$rows = $this->db->prepare($query);
$rows->execute([$id]);

The error it gives is this:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? ORDER BY nome_cliente' at line 1
Luís Alves
  • 463
  • 1
  • 5
  • 20

0 Answers0