I'm trying to dockerize my website but I got this error and nothing to fix it.
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND d.TableRef = 'page') OR page.Publique = 1) AND Deconnecte = 1 ORDER BY `Ordr' at line 9' in /var/www/html/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Statement.php:240 Stack trace: #0 /var/www/html/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Statement.php(240): PDOStatement->execute() #1 /var/www/html/vendor/zendframework/zendframework/library/Zend/Db/TableGateway/AbstractTableGateway.php(233): Zend\Db\Adapter\Driver\Pdo\Statement->execute() #2 /var/www/html/vendor/zendframework/zendframework/library/Zend/Db/TableGateway/AbstractTableGateway.php(208): Zend\Db\TableGateway\AbstractTableGateway->executeSelect(Object(Zend\Db\Sql\Select)) #3 /var/www/html/vendor/zendframework/zendframework/library/Zend/Db/TableGateway/Abs in /var/www/html/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Statement.php on line 245
In local, it works. But when I try with Docker, I got this error. It is the same code, and the same version.
- MariaDB 10.4
- php5.6
- Apache2
My phpmyadmin works very well, so I think the problem came from the file .sql.
Here the portion of code where the problem occur :
->where("(page.IDPage IN (
SELECT d.IDLigne
FROM inscrit i
JOIN lien_inscrit_role lir ON lir.IDInscrit = i.IDInscrit
JOIN lien_droit_role ldr ON ldr.IDRole = lir.IDRole
JOIN droit d ON d.IDDroit = ldr.IDDroit
JOIN page p ON p.IDPage = d.IDLigne
WHERE i.IDInscrit = $idInscrit
AND d.TableRef = 'page')"
. " OR page.Publique = 1)");