i can’t find the error please tell me if someone know this error:sob:
looks like an error in your sql statement
Line Error 35 but I cant find the error plz tell me the error
I am struglling with this error for a week
Your query is failing due to an error. You ALWASY need error handling for statements that can fail. For database statements, the easiest way of adding error handling is to use exceptions for errors and in most cases let php catch and handle the exception. To use exceptions for errors for the mysqli extension, add the following line of code before the point where you make the database connection -
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
No. That particular line of code is okay.
There are 2-3 ways the sql query could think there is column named $id -
- The double-quotes around the sql query statement aren’t actually straight ascii quotes and php is not replacing the contents of the variable with its value. If this is the case, which is usually caused by copy/pasting things, you would need to delete and retype the double-quotes.
- There’s something wrong with the $ character and it isn’t being seen by php as the start of a variable name. Again, this type of error is usually caused by copy/pasting things, and you would need to delete and retype the $.
- The $id variable literally contains the characters $, i, and d, rather than an id value. This would most likely be caused by a problem in the ‘add to cart’ form or form processing code, where some single-quotes were used around the php variable ‘$id’, making it a string consisting of the characters $, i, and d.
Also, please don’t post pictures of your code/errors. It makes it impossible to quote parts of them in a reply. Post the actual code/errors in the forum, adding bbocde
[code][/code] tags around them.
Thanks for your advice