What are the potential pitfalls of using spaces in table names in a MySQL database when working with PHP?

Using spaces in table names in a MySQL database can lead to syntax errors when querying the database in PHP. To avoid this issue, it is recommended to avoid using spaces in table names and instead use underscores or camel case notation.

// Example of querying a table with a space in its name
$tableName = "my table";
$query = "SELECT * FROM `$tableName`";
// This will result in a syntax error

// Instead, use underscores or camel case notation for table names
$tableName = "my_table";
$query = "SELECT * FROM `$tableName`";
// This query will work without any issues