Are there any potential syntax errors when using the command "SHOW TABLES FROM $dbname" in PHP to list tables in a database?

When using the command "SHOW TABLES FROM $dbname" in PHP to list tables in a database, potential syntax errors may occur if the variable $dbname is not properly concatenated within the SQL query. To solve this issue, make sure to concatenate the variable within the query string using double quotes.

$dbname = "your_database_name";
$sql = "SHOW TABLES FROM " . $dbname;

// Execute the query and fetch the results
$result = $conn->query($sql);
if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        echo $row['Tables_in_' . $dbname] . "<br>";
    }
}