什麼不對這個語法,請:MySQL查詢錯誤的語法
$stmt = $db->query('SELECT id, par, what, title, inde
FROM tmatria
ORDER BY inde ASC
where par = ' . $_SESSION["par"] . ';');
錯誤:
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 'where par = 0' at line 1
ORDER BY應該在WHERE子句之後? – user3741598
** RTM ** http://dev.mysql.com/doc/refman/5.7/en/select.html和'WHERE'是一個保留字,它解釋** first **語法錯誤'near'where 'https://dev.mysql.com/doc/refman/5.7/en/keywords.html –
請閱讀SQL教程。子句的順序不靈活,任何教程都應該顯示正確的語法。 – Barmar