Here is such a mistake
SQLSTATE [42000]: Syntax error or access violation: 1064 SQL syntax; check the syntax to use mySQL? at line 1
occurs when trying to prepare a query of the form
SHOW TABLES LIKE :1 when disabling the emulation of prepared requests in the code
$conn = new PDO('mysql:dbname=testdb;host=127.0.0.1;charset=utf8', 'root', 'root', [ PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, ]); $sth = $conn->prepare('SHOW TABLES LIKE :1'); <-- тут ошибка $sth->execute([':1' => 'test']); var_dump($sth->fetchAll()); PHP 7.0.4 and 5.6.13
MySQL 5.6.20
Windows 7 :)
Question: What to do? Is this my local glitch or PDO globally curved?
UPD With a view request
SHOW COLUMNS FROM `test` LIKE ? similar situation.
?, and ': table', the error does not disappear until I deletePDO::ATTR_EMULATE_PREPARES => false,There are no errors in queries withSELECTandLIKE. - Visman