Skip to content
Advertisement

Php mysql query update of data gives syntax error

This is my php code to update products in database:

JavaScript

It gives this error:

JavaScript

Advertisement

Answer

This code should work:

JavaScript

But a better approach would be to use parameterized prepared statements as you are vulnerable now to SQL injections. Also refer to: https://dev.mysql.com/doc/apis-php/en/apis-php-mysqli.quickstart.prepared-statements.html

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement