By the way: What in the world is the point in putting the name of a database table into a PHP variable in the first place?
Surely, in any database coding you will do, you will know that name of the table ahead of time. So just put it directly into the SQL string without using a PHP variable.
[There are rare exceptions, as when--say--you are building some kind of database tool. But that's in the somewhat distant future for you, almost surely.]
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.