Is it possible, to use a dynamic value inside a SELECT FROM sql command?
Database->prepare("SELECT bomb FROM ? WHERE id=?")
    ->execute($strTable,$strID);
result:
Fatal error: Uncaught exception Exception with message Query error: 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...
No. The table name cannot be a parameter of the query. You'd need to construct your query string first, concatenating the table name in.
Assuming $strTable is from a safe source just use
Database->prepare("SELECT bomb FROM $strTable WHERE id=?")
    ->execute($strID);
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With