rahman rahman - 1 month ago 14
PHP Question

Error in SQL syntax of PHP report from MySQL database

Error:


SELECT * FROM stock_sales where transactionid=\"SD254\"

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 '\"SD254\"' at line 1

Answer

Unless your database is set up to handle double quotes, the normal way to write this query in MySQL would be

SELECT * FROM stock_sales where transactionid='SD254'
Comments